Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-6720

VCS: add support for phrase matching in PostgreSQL fulltext search

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5
    • Environment:
      PostgreSQL
    • Impact type:
      Content model Change
    • Upgrade notes:
      Hide

      IMPORTANT: Please read the upgrade notes from NXP-5689.

      Show
      IMPORTANT: Please read the upgrade notes from NXP-5689 .

      Description

      For PostgreSQL, where this feature is not supported natively, we will match the phrase "foo bar" using:

      to_tsquery('foo & bar') @@ to_tsvector(fulltext)
        AND fulltext LIKE '% foo bar %'
      

      This means that the fulltext column will have to be in clear text, pre-canonicalized (lowercase, no diacritics), and with an initial and trailing space.

      Note that a more complex match like

      abc "foo bar" -"gee man"
      

      will have to be turned into something like:

      to_tsquery('abc & foo & bar') @@ to_tsvector(fulltext)
        AND (fulltext LIKE '% foo bar %' AND NOT fulltext LIKE '% gee man %')
      

      i.e., the initial fulltext match has to match a superset of the complete query, so it cannot easily contain excluded phrases.

      Algorithm:

      1. pre-filter using fulltext on a query that is a superset of the original query (remove negative phrases (which are at AND level), and split positive phrases into ANDed words),
      2. AND with a LIKE-based search for all terms, except those that are already exactly matched by the first part, i.e., toplevel ANDed non-phrases.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fguillaume Florent Guillaume
                Reporter:
                fguillaume Florent Guillaume
                Participants:
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.