Skip to content

sql: support tsvector, tsquery based full text search #41288

@rohany

Description

@rohany

Postgres has some advanced text search types and features that Django uses that we we don't support --
https://www.postgresql.org/docs/10/functions-textsearch.html
https://www.postgresql.org/docs/10/datatype-textsearch.html

This includes the tsvector and regconfig types and operations on them.

  • parsers (tokenizing)
  • the rest of the token types supported by Postgres's default parser: tsearch: support all token types in text search parser #97669
  • dictionaries (stemming and stopwords - made by parameterizing a template)
  • templates (templates for dictionaries)
  • configurations (pair of parser and dictionary)
  • regconfig datatype
  • regdictionary datatype
  • tsvector datastructure
  • tsquery datastructure
  • to_tsvector
  • to_tsquery
  • phraseto_tsquery
  • plainto_tsquery
  • websearch_to_tsquery
  • tsquery_phrase
  • accelerated searches with @@
  • GIN index on tsvectors
  • weights
  • ts_rank
  • ts_rank_cd
  • strip(tsvector)
  • length(tsvector)
  • setweight(tsvector)
  • array_to_tsvector(text[])
  • numnode(tsquery)
  • querytree(tsquery)
  • ts_delete(tsvector, text)
  • ts_headline
  • ts_rewrite
  • tsvector_to_array(tsvector)
  • jsonb_to_tsvector / json_to_tsvector (sql: support jsonb_to_tsvector #109955)
  • unnest(tsvector)
  • inverted join on tsvectors

And SQL operators for tsvector:

  • @@ (matching a tsvector and tsquery)
  • tsvector || tsvector (concatenation of tsquery)
  • tsquery || tsquery (OR 2 tsqueries)
  • tsquery && tsquery (AND 2 tsqueries)
  • tsquery <-> tsquery (followedby 2 tsqueries()
  • !! tsquery (negate a tsquery)
  • tsquery @> tsquery (contains)
  • tsquery <@ tsquery (contained-by)

Jira issue: CRDB-5464
Epic: CRDB-22357

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-pgcompatSemantic compatibility with PostgreSQLA-tools-efcoreC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions