Skip to main content
The SQL FILTER_BY_STRING function, as well as the /filter/bystring endpoint, enables the use of several string-based search modes, including full text search via the search mode. The syntax and restrictions for this search follow, including examples of applying different search criteria. In order for a full text search to be applied to a column, the following requirements must be met:
  • Full text search must be enabled by setting enable_text_search to true in the /opt/gpudb/core/etc/gpudb.conf configuration file; see Text Search for details.
  • The column must be a string type and have the text_search column property applied. The following specific types under the string base type are text-searchable:
    • char1 - char256
    • date
    • datetime
    • ipv4
    • string
    • time
    • uuid

Individual Term Match

To search for one or more search terms, add the terms to a space-separated list.

Exact Phrase Match

To search for an exact phrase, double quote the entire search text.

Boolean Operations

Valid operators include NOT, AND, OR, & parentheses (). An OR is assumed if no operator is specified.

Wildcard Match

Wildcard matches can be specified with either single-character or multi-character wildcards, or a combination of the two:
  • ? - Exactly one character
  • * - Zero or more characters

Fuzzy Match

Fuzzy matches can be specified by appending a tilde (~) to the end of the fuzzy match term. A decimal number between 0 (inclusive) and 1 (exclusive) can be used to specify the minimum relative similarity of the match, with 0 indicating the fuzziest match possible, and values closer to 1 indicating an increasingly stricter match. The default match threshold is .5.

Proximity Match

To match two words within a specified distance of each other, quote the two terms, separated by a space, and append a tilde (~) followed by the distance in number of words.

Term Relevance

To increase the relevance of a matched search term versus other given terms, append a caret (^) followed by a positive numeric boosting factor for that term. A quote-enclosed phrase can also have its relevance increased. The default factor is 1.

Required, Optional, & Prohibited Matches

Within the context of a group of terms, any of the terms can be marked as required or prohibited:
  • + - when prepended to a term, requires that the term be matched
  • - - when prepended to a term, prohibits matches on the term
  • <no marker> - when neither marker is prepended to a term, the term is optional

Range Matches

Inclusive [<term1> TO <term2>] and exclusive {<term1> TO <term2>} matches are supported. Matches where one side is inclusive and the other exclusive are not supported.

Escaping Special Characters

Special characters are escaped with a backslash (\). Special characters include:

Restrictions

  • The first character of a search term cannot be a wildcard (* or ?)
  • Search terms cannot be any of the following: