Casecommons / pg_search

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search
http://www.casebook.net
MIT License
1.3k stars 369 forks source link

Adds support for tsvector_column in associated_against (pg_search_scope) #504

Open mhenrixon opened 1 year ago

mhenrixon commented 1 year ago

Adds alternative option syntax for tsvector_column. Adds migration for tsvector aggregation. Adds support for tsvector columns in associated models.

Closes #499 in favor of this

pg_search_scope :full_text_search, (lambda do |query, locale = "swedish"|
    {
      query: query,
      associated_against: {
        taggings: { name: "B" },
        editables: {
          content_tsvector: { tsvector_column: true },
        },
      },
      order_within_rank: "articles.id DESC",
      using: {
        tsearch: {
          dictionary: SearchDocument.dictionary(locale),
          prefix: true,
        },
      },
    }
  end)