-
Notifications
You must be signed in to change notification settings - Fork 380
Open
Description
As seen here: https://www.postgresql.org/docs/current/textsearch-controls.html
class Post < ApplicationRecord
pg_search_scope :search_by_title, against: :title
endPost.search_by_title("word|word")
Post.search_by_title.phrase("somebody once told me the world was gonna roll me")
Post.search_by_title.plain("Shrek is the best")pg_search/lib/pg_search/features/tsearch.rb
Lines 101 to 113 in 056bddb
| def tsquery_for_term(unsanitized_term) | |
| if options[:negation] && unsanitized_term.start_with?("!") | |
| unsanitized_term[0] = "" | |
| negated = true | |
| end | |
| sanitized_term = unsanitized_term.gsub(DISALLOWED_TSQUERY_CHARACTERS, " ") | |
| term_sql = Arel.sql(normalize(connection.quote(sanitized_term))) | |
| tsquery = tsquery_expression(term_sql, negated: negated, prefix: options[:prefix]) | |
| Arel::Nodes::NamedFunction.new("to_tsquery", [dictionary, tsquery]).to_sql |
Maybe we can add an options hash here to swap out the desired function? I'm new to Ruby but this is my best guess.
tomcardoso, mikehale and ClaytonPassmore
Metadata
Metadata
Assignees
Labels
No labels