Index: openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl,v diff -u -N -r1.41.2.4 -r1.41.2.5 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 3 May 2020 18:00:42 -0000 1.41.2.4 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 24 Feb 2021 12:51:17 -0000 1.41.2.5 @@ -135,6 +135,7 @@ # Clean up query for tsearch2 # set query [tsearch2::build_query -query $query] + # ns_log notice "-----build_query returned: $query" set where_clauses "" set from_clauses "" @@ -240,7 +241,7 @@ return [list package_key tsearch2-driver version 2 automatic_and_queries_p 0 stopwords_p 1] } -ad_proc tsearch2::build_query { -query } { +ad_proc tsearch2::build_query_tcl { -query } { Convert conjunctions to query characters for tsearch2 and => & not => ! @@ -302,6 +303,60 @@ return $query } +ad_proc tsearch2::build_query_postgres { -query } { + 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: + +