Class: Sunspot::Query::StandardQuery

Inherits:
CommonQuery show all
Defined in:
lib/sunspot/query/standard_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommonQuery

#[], #add_field_facet, #add_field_list, #add_function, #add_geo, #add_group, #add_parameter_adjustment, #add_query_facet, #add_sort, #add_spellcheck, #add_stats, #cursor, #page, #paginate, #per_page, #to_params

Constructor Details

#initialize(types) ⇒ StandardQuery

Returns a new instance of StandardQuery.



6
7
8
9
# File 'lib/sunspot/query/standard_query.rb', line 6

def initialize(types)
  super
  @components << @fulltext = Conjunction.new
end

Instance Attribute Details

#fulltextObject

Returns the value of attribute fulltext.



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

def fulltext
  @fulltext
end

#scopeObject

Returns the value of attribute scope.



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

def scope
  @scope
end

Instance Method Details

#add_boost_function(function) ⇒ Object



23
24
25
# File 'lib/sunspot/query/standard_query.rb', line 23

def add_boost_function(function)
  @fulltext.add_boost_function(function)
end

#add_boost_query(factor) ⇒ Object



19
20
21
# File 'lib/sunspot/query/standard_query.rb', line 19

def add_boost_query(factor)
  @fulltext.add_boost_query(factor)
end

#add_fulltext(keywords) ⇒ Object



11
12
13
# File 'lib/sunspot/query/standard_query.rb', line 11

def add_fulltext(keywords)
  @fulltext.add_fulltext(keywords)
end

#add_join(keywords, target, from, to) ⇒ Object



15
16
17
# File 'lib/sunspot/query/standard_query.rb', line 15

def add_join(keywords, target, from, to)
  @fulltext.add_join(keywords, target, from, to)
end

#add_multiplicative_boost_function(function) ⇒ Object



27
28
29
# File 'lib/sunspot/query/standard_query.rb', line 27

def add_multiplicative_boost_function(function)
  @fulltext.add_multiplicative_boost_function(function)
end

#conjunctionObject



40
41
42
43
44
45
46
47
# File 'lib/sunspot/query/standard_query.rb', line 40

def conjunction
  parent_fulltext = @fulltext
  @fulltext = @fulltext.add_conjunction

  yield
ensure
  @fulltext = parent_fulltext
end

#disjunctionObject



31
32
33
34
35
36
37
38
# File 'lib/sunspot/query/standard_query.rb', line 31

def disjunction
  parent_fulltext = @fulltext
  @fulltext = @fulltext.add_disjunction

  yield
ensure
  @fulltext = parent_fulltext
end