import { Expression } from '../expressions'; import { ArrayType, IntegerType, RealType, CharacterArg, TextType, TSQueryType, TSVectorType, ArrayArg, TSQueryArg, TSVectorArg, JSONArg, JSONBArg, IntegerArg } from '../types'; /** * @description Converts an array of lexemes to a tsvector. * The given strings are used as-is without further processing. * * @sql array_to_tsvector('{fat,cat,rat}'::text[]): 'cat' 'fat' 'rat' */ export declare function ARRAY_TO_TSVECTOR(arg: ArrayArg): Expression; /** * @description Returns the OID of the current default text search configuration (as set by default_text_search_config). * * @sql get_current_ts_config(): english */ export declare function GET_CURRENT_TS_CONFIG(): Expression; /** * @description Returns the number of lexemes plus operators in the tsquery. * * @sql numnode('(fat & rat) | cat'::tsquery): 5 */ export declare function NUMNODE(arg: TSQueryArg): Expression; /** * @description Converts text to a tsquery, normalizing words according to the specified or default configuration. * Any punctuation in the string is ignored (it does not determine query operators). * The resulting query matches documents containing all non-stopwords in the text. * * @sql plainto_tsquery('english', 'The Fat Rats'): 'fat' & 'rat' */ export declare function PLAINTO_TSQUERY(query: CharacterArg, lang?: CharacterArg): Expression; /** * @description Converts text to a tsquery, normalizing words according to the specified or default configuration. * Any punctuation in the string is ignored (it does not determine query operators). * The resulting query matches phrases containing all non-stopwords in the text. * * @sql phraseto_tsquery('english', 'The Fat Rats'): 'fat' <-> 'rat' */ export declare function PHRASETO_TSQUERY(query: CharacterArg, lang?: CharacterArg): Expression; /** * @description Converts text to a tsquery, normalizing words according to the specified or default configuration. * Quoted word sequences are converted to phrase tests. * The word “or” is understood as producing an OR operator, and a dash produces a NOT operator; other punctuation is ignored. * This approximates the behavior of some common web search tools. * * @sql websearch_to_tsquery('english', '\"fat rat\" or cat dog'): 'fat' <-> 'rat' | 'cat' & 'dog' */ export declare function WEBSEARCH_TO_TSQUERY(query: CharacterArg, lang?: CharacterArg): Expression; /** * @description Produces a representation of the indexable portion of a tsquery. * A result that is empty or just T indicates a non-indexable query. * * @sql querytree('foo & ! bar'::tsquery): 'foo' */ export declare function QUERYTREE(query: TSQueryArg): Expression; /** * @description Assigns the specified weight to elements of the vector [ that are listed in lexemes ]. * * @sql * setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A'): 'cat':3A 'fat':2A,4A 'rat':5A * setweight('fat:2,4 cat:3 rat:5,6B'::tsvector, 'A', '{cat,rat}'): 'cat':3A 'fat':2,4 'rat':5A,6A */ export declare function SETWEIGHT(vector: TSVectorArg, weight: CharacterArg, lexemes?: ArrayArg): Expression; /** * @description Removes positions and weights from the tsvector. * * @sql strip('fat:2,4 cat:3 rat:5A'::tsvector): 'cat' 'fat' 'rat' */ export declare function STRIP(vector: TSVectorArg): Expression; /** * @description Converts text to a tsquery, normalizing words according to the specified or default configuration. * The words must be combined by valid tsquery operators. * * @sql to_tsquery('english', 'The & Fat & Rats'): 'fat' & 'rat' */ export declare function TO_TSQUERY(query: CharacterArg, lang?: CharacterArg): Expression; /** * @description TEXT: Converts text to a tsvector, normalizing words according to the specified or default configuration. * Position information is included in the result. * JSON | JSONB: Converts each string value in the JSON document to a tsvector, normalizing words according to the specified or default configuration. * The results are then concatenated in document order to produce the output. * Position information is generated as though one stopword exists between each pair of string values. * (Beware that “document order” of the fields of a JSON object is implementation-dependent when the input is jsonb; observe the difference in the examples.) * * @sql * to_tsvector('english', 'The Fat Rats'): 'fat':2 'rat':3 * to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::json) → 'dog':5 'fat':2 'rat':3 * to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::jsonb) → 'dog':1 'fat':4 'rat':5 */ export declare function TO_TSVECTOR(document: CharacterArg | JSONArg | JSONBArg, lang?: CharacterArg): Expression; /** * @description Selects each item in the JSON document that is requested by the filter and converts each one to a tsvector, * normalizing words according to the specified or default configuration. * The results are then concatenated in document order to produce the output. * Position information is generated as though one stopword exists between each pair of selected items. * (Beware that “document order” of the fields of a JSON object is implementation-dependent when the input is jsonb.) * The filter must be a jsonb array containing zero or more of these keywords: "string" (to include all string values), * "numeric" (to include all numeric values), "boolean" (to include all boolean values), "key" (to include all keys), * or "all" (to include all the above). As a special case, the filter can also be a simple JSON value that is one of these keywords. * * @sql jsonb_to_tsvector ( [ config regconfig, ] document jsonb, filter jsonb ): tsvector */ export declare function JSON_TO_TSVECTOR(document: JSONArg, filter: JSONBArg, config?: CharacterArg): Expression; /** * @description jsonb_to_tsvector ( [ config regconfig, ] document jsonb, filter jsonb ): tsvector * * @sql Selects each item in the JSON document that is requested by the filter and converts each one to a tsvector, * normalizing words according to the specified or default configuration. * The results are then concatenated in document order to produce the output. * Position information is generated as though one stopword exists between each pair of selected items. * (Beware that “document order” of the fields of a JSON object is implementation-dependent when the input is jsonb.) * The filter must be a jsonb array containing zero or more of these keywords: "string" (to include all string values), * "numeric" (to include all numeric values), "boolean" (to include all boolean values), "key" (to include all keys), * or "all" (to include all the above). As a special case, the filter can also be a simple JSON value that is one of these keywords. */ export declare function JSONB_TO_TSVECTOR(document: JSONBArg, filter: JSONBArg, config?: CharacterArg): Expression; /** * @description Removes any occurrence of the given lexeme from the vector. * * @sql ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat'): 'cat':3 'rat':5A * @sql ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']): 'cat':3 */ export declare function TS_DELETE(vector: TSVectorArg, lexeme: CharacterArg | ArrayArg): Expression; /** * @description Selects only elements with the given weights from the vector. * @sql ts_filter('fat:2,4 cat:3b,7c rat:5A'::tsvector, '{a,b}'): 'cat':3B 'rat':5A */ export declare function TS_FILTER(vector: TSVectorArg, weight: ArrayArg): Expression; /** * @description Displays, in an abbreviated form, the match(es) for the query in the document * (or in string values within the JSON document), which must be raw text not a tsvector. * Words in the document are normalized according to the specified or default configuration before matching to the query. * Use of this function is discussed in Section 12.3.4, which also describes the available options. * * @sql ts_headline('The fat cat ate the rat.', 'cat'): The fat cat ate the rat. */ export declare function TS_HEADLINE(document: CharacterArg | JSONArg | JSONBArg, query: TSQueryArg, options?: CharacterArg, config?: CharacterArg): Expression; /** * @description Computes a score showing how well the vector matches the query. See Section 12.3.3 for details. * @sql ts_rank(to_tsvector('raining cats and dogs'), 'cat'): 0.06079271 */ export declare function TS_RANK(vector: TSVectorArg, query: TSQueryArg, weights?: ArrayArg, normalization?: IntegerArg): Expression; /** * @description Computes a score showing how well the vector matches the query, using a cover density algorithm. See Section 12.3.3 for details. * @sql ts_rank_cd(to_tsvector('raining cats and dogs'), 'cat'): 0.1 */ export declare function TS_RANK_CD(vector: TSVectorArg, query: TSQueryArg, weights?: ArrayArg, normalization?: IntegerArg): Expression; /** * @description Replaces occurrences of target with substitute within the query. See Section 12.4.2.1 for details. * @sql ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery): 'b' & ( 'foo' | 'bar' ) */ export declare function TS_REWRITE(query: TSQueryArg, target: TSQueryArg, substitute: TSQueryArg): Expression; export declare function TS_REWRITE(query: TSQueryArg, select: CharacterArg): Expression; /** * @description Constructs a phrase query that searches for matches of query1 and query2 at successive lexemes (same as <-> operator). * @sql tsquery_phrase(to_tsquery('fat'), to_tsquery('cat')): 'fat' <-> 'cat' */ export declare function TSQUERY_PHRASE(q1: TSQueryArg, q2: TSQueryArg, distance?: IntegerArg): Expression; /** * @description Converts a tsvector to an array of lexemes. * @sql tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector): {cat,fat,rat} */ export declare function TSVECTOR_TO_ARRAY(vector: TSVectorArg): Expression>;