Text filter for full-text search on text fields.
Text fields in Redis support various types of text matching including exact phrases, wildcard patterns, and fuzzy matching. Text fields are tokenized and support full-text search capabilities.
Text fields must be indexed with the TEXT type in the metadata schema.
class TextFilterDiscriminator property for type-safe filter identification. Each filter type has a unique filterType value.
Combine this filter with another using AND logic.
In RediSearch, AND operations are represented by space-separated conditions
within parentheses: (condition1 condition2)
Combine this filter with another using OR logic.
In RediSearch, OR operations are represented by pipe-separated conditions
within parentheses: (condition1|condition2)
Converts the filter expression to a RediSearch query string.
Creates a builder object for constructing text filters.
// Exact phrase match
const filter = new TextFilter("title", "wireless headphones", "exact");
// Generates: @title:("wireless headphones")
// Wildcard match (use * for any characters)
const filter = new TextFilter("title", "head*", "wildcard");
// Generates: @title:(head*)
// Fuzzy match (allows typos/variations)
const filter = new TextFilter("title", "headphone", "fuzzy");
// Generates: @title:(%%headphone%%)
// Word match (tokenized search)
const filter = new TextFilter("description", "bluetooth wireless", "match");
// Generates: @title:(bluetooth wireless)
// Using convenience methods
const filter = Text("title").exact("wireless headphones");
const filter2 = Text("title").wildcard("*phone*");
const filter3 = Text("description").fuzzy("blutooth");