Class: Mincer::PgSearch::SearchEngines::Trigram

Inherits:
Base
  • Object
show all
Defined in:
lib/mincer/processors/pg_search/search_engines/trigram.rb

Constant Summary collapse

@@default_threshold =
nil

Instance Attribute Summary

Attributes inherited from Base

#args, #search_statements

Instance Method Summary collapse

Methods inherited from Base

#arel_group, #engine_sym, #initialize, #prepared_search_statements, #quote, #sanitize_column, #sanitize_string, #sanitize_string_quoted, #search_engine_statements

Methods included from Mincer::Processors::Helpers

#join_expressions

Constructor Details

This class inherits a constructor from Mincer::PgSearch::SearchEngines::Base

Instance Method Details

#conditionsObject



7
8
9
10
11
12
# File 'lib/mincer/processors/pg_search/search_engines/trigram.rb', line 7

def conditions
  return nil unless prepared_search_statements.any?
  arel_group do
    join_expressions(prepared_search_statements.map { |search_statement| document_for(search_statement) }, :or)
  end
end

#rankObject



14
15
16
17
18
19
# File 'lib/mincer/processors/pg_search/search_engines/trigram.rb', line 14

def rank
  return nil unless prepared_search_statements.any?
  arel_group do
    join_expressions(prepared_search_statements.map { |search_statement| rank_for(search_statement) }, :+)
  end
end