Class: Sunspot::Query::CompositeFulltext

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

Instance Method Summary (collapse)

Constructor Details

- (CompositeFulltext) initialize

A new instance of CompositeFulltext



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

def initialize
  @components = []
end

Instance Method Details

- (Object) add(keywords)



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

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

- (Object) add_location(field, lat, lng, options)



13
14
15
16
# File 'sunspot/lib/sunspot/query/composite_fulltext.rb', line 13

def add_location(field, lat, lng, options)
  @components << location = Geo.new(field, lat, lng, options)
  location
end

- (Object) to_params



18
19
20
21
22
23
24
25
26
27
# File 'sunspot/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