Class: Sunspot::Query::CompositeFulltext
- Inherits:
-
Object
- Object
- Sunspot::Query::CompositeFulltext
- Defined in:
- lib/sunspot/query/composite_fulltext.rb
Instance Method Summary collapse
- #add(keywords) ⇒ Object
- #add_location(field, lat, lng, options) ⇒ Object
-
#initialize ⇒ CompositeFulltext
constructor
A new instance of CompositeFulltext.
- #to_params ⇒ Object
Constructor Details
#initialize ⇒ CompositeFulltext
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 |
#add_location(field, lat, lng, options) ⇒ Object
13 14 15 16 |
# File 'lib/sunspot/query/composite_fulltext.rb', line 13 def add_location(field, lat, lng, ) @components << location = Geo.new(field, lat, lng, ) location end |
#to_params ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sunspot/query/composite_fulltext.rb', line 18 def to_params case @components.length when 0 {} when 1 @components.first.to_params.merge(:fl => '* score') else to_subqueries.merge(:fl => '* score') end end |