Adds support for tsvector_column in associated_against (pg_search_scope) - #580
Open
mhenrixon wants to merge 1 commit into
Open
Adds support for tsvector_column in associated_against (pg_search_scope)#580mhenrixon wants to merge 1 commit into
mhenrixon wants to merge 1 commit into
Conversation
Lets a pg_search_scope search associated models through a precomputed
tsvector column instead of building to_tsvector(...) at query time:
pg_search_scope :search, associated_against: {
comments: { body_tsvector: { tsvector_column: true } }
}
- Column accepts `{ tsvector_column: true, weight: ... }` in place of a bare
weight and emits `coalesce(col::tsvector, '')` for such columns.
- Association selects cast to tsvector (singular) or aggregate with a new
`tsvector_agg` (plural) instead of string_agg(...::text).
- Tsearch skips the to_tsvector() wrap for tsvector columns.
- `pg_search:migration:associated_against_tsvector` generator installs the
`tsvector_agg` aggregate (sql/tsvector_agg.sql).
Rebased onto master (was PR Casecommons#504's 2.3.6-based branch), standardrb clean,
suite green on Ruby 4.0 / Active Record 8.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Supersedes #504 (same change, rebased onto current
masteras a single commit; standardrb clean, suite green on Ruby 4.0 / Active Record 8.1).