Class: Sunspot::Query::CompositeFulltext

Inherits:
Object
  • Object
show all
Defined in:
lib/sunspot/query/composite_fulltext.rb

Instance Method Summary collapse

Constructor Details

#initializeCompositeFulltext

Returns a new instance of CompositeFulltext.



4
5
6
# File 'lib/sunspot/query/composite_fulltext.rb', line 4

def initialize
  @components = []
end

Instance Method Details

#add(keywords) ⇒ Object



8
9
10
11
# File 'lib/sunspot/query/composite_fulltext.rb', line 8

def add(keywords)
  @components << dismax = Dismax.new(keywords)
  dismax
end

#to_paramsObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/sunspot/query/composite_fulltext.rb', line 13

def to_params
  case @components.length
  when 0
    {}
  when 1
    @components.first.to_params
  else
    to_subqueries
  end
end