Class: PgSearch::Features::TSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_search/features/tsearch.rb

Instance Method Summary collapse

Constructor Details

#initialize(query, options, columns, model, normalizer) ⇒ TSearch



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pg_search/features/tsearch.rb', line 8

def initialize(query, options, columns, model, normalizer)
  @query = query
  @options = options || {}
  @model = model
  @columns = columns
  @normalizer = normalizer

  if @options[:prefix] && @model.connection.send(:postgresql_version) < 80400
    raise PgSearch::NotSupportedForPostgresqlVersion.new("      Sorry, {:using => {:tsearch => {:prefix => true}}} only works in PostgreSQL 8.4 and above.\")\n    MESSAGE\n  end\nend\n".gsub /^\s*/, '')

Instance Method Details

#conditionsObject



22
23
24
# File 'lib/pg_search/features/tsearch.rb', line 22

def conditions
  ["(#{tsdocument}) @@ (#{tsquery})", interpolations]
end

#rankObject



26
27
28
# File 'lib/pg_search/features/tsearch.rb', line 26

def rank
  tsearch_rank
end