-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for tsvector_column in associated_against (pg_search_scope)
Adds alternative option syntax for tsvector_column. Adds migration for tsvector aggregation. Adds support for tsvector columns in associated models. Missing: More tests and documentation.
- Loading branch information
1 parent
9d718b5
commit e3fae89
Showing
12 changed files
with
596 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
13 changes: 13 additions & 0 deletions
13
lib/pg_search/migration/associated_against_tsvector_generator.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'pg_search/migration/generator' | ||
|
||
module PgSearch | ||
module Migration | ||
class AssociatedAgainstTsvectorGenerator < Generator | ||
def migration_name | ||
'add_pg_search_associated_against_tsvector_support_functions' | ||
end | ||
end | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
...ch/migration/templates/add_pg_search_associated_against_tsvector_support_functions.rb.erb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class AddPgSearchAssociatedAgainstTsvectorSupportFunctions < ActiveRecord::Migration | ||
def self.up | ||
say_with_time("Adding tsvector support functions for pg_search :associated_against") do | ||
execute <<-'SQL' | ||
<%= read_sql_file "tsvector_agg" %> | ||
SQL | ||
end | ||
end | ||
|
||
def self.down | ||
say_with_time("Dropping tsvector support functions for pg_search :associated_against") do | ||
execute <<-'SQL' | ||
<%= read_sql_file "uninstall_tsvector_agg" %> | ||
SQL | ||
end | ||
end | ||
end |
This file contains 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
Oops, something went wrong.