tsearch2::build_query_postgres (private)

 tsearch2::build_query_postgres [ -query query ]

Defined in packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl

Convert conjunctions to query characters for tsearch2 use websearch_to_tsquery which is integrated in postgres >= 11 websearch_to_tsquery creates a tsquery value from querytext using an alternative syntax in which simple unformatted text is a valid query. Unlike plainto_tsquery and phraseto_tsquery, it also recognizes certain operators. Moreover, this function should never raise syntax errors, which makes it possible to use raw user-supplied input for search. The following syntax is supported:

  • unquoted text: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
  • "quoted text": text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery.
  • OR: logical or will be converted to the | operator.
  • -: the logical not operator, converted to the ! operator.
For further documentation see also: https://www.postgresql.org/docs/11/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES

Switches:
-query (optional)
string to convert
Returns:
returns formatted query string for tsearch2 tsquery

Partial Call Graph (max 5 caller/called nodes):
%3 tsearch2::build_query tsearch2::build_query (private) tsearch2::build_query_postgres tsearch2::build_query_postgres tsearch2::build_query->tsearch2::build_query_postgres ad_try ad_try (public) tsearch2::build_query_postgres->ad_try db_1row db_1row (public) tsearch2::build_query_postgres->db_1row tsearch2::build_query_tcl tsearch2::build_query_tcl (public) tsearch2::build_query_postgres->tsearch2::build_query_tcl

Testcases:
No testcase defined.
Source code:
    ad_try {
        db_1row build_querystring {select websearch_to_tsquery(:query) as query from dual}
    } on error {errorMsg} {
        ns_log warning "tsearch2 websearch_to_tsquery failed,"  "fall back to tcl query builder query was: $query errorMsg: $errorMsg"
        set query [tsearch2::build_query_tcl -query $query]
    }
    return $query
XQL Not present:
Generic, Oracle
PostgreSQL XQL file:
packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql

[ hide source ] | [ make this the default ]
Show another procedure: