Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websearch query syntax #11

Merged
merged 2 commits into from Aug 5, 2019

Conversation

@ThomasWeiser
Copy link
Owner

commented Aug 5, 2019

  • Offer "websearch" syntax for FTS queries, like signal -"segmentation fault".
    This uses the function websearch_to_tsquery, which supports the following constructs (see PostgreSQL documentation):
    • 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 the ! operator.
  • Applies to general FTS queries and to simplefts json attribute tests (currently used in the "title" filter).
  • For compatibility with older versions of PostgreSQL we dynamically check the availability of the function websearch_to_tsquery. Otherwise we fall back to using plainto_tsquery.

ThomasWeiser added some commits Aug 5, 2019

Use websearch_to_tsquery if available
We want to offer "websearch" syntax for FTS queries, like `signal -"segmentation fault"`.

PostgreSQL version 11 introduces the function websearch_to_tsquery for this purpose, which we now use if available.

We check for availability of this function because (for the time being) we want to be backward compatible with PostgreSQL version 10.

@ThomasWeiser ThomasWeiser merged commit 86edc2e into master Aug 5, 2019

@ThomasWeiser ThomasWeiser deleted the websearch-query-syntax branch Aug 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.