Module: Eson::Search::Queries
- Included in:
- ConstantScore, CustomBoostFactor, CustomFiltersScore, CustomScore, DisMax, FQuery, Filtered, QueryFacet, QueryGroup, SpanFirst
- Defined in:
- lib/compat.rb,
lib/eson/search/queries.rb
Defined Under Namespace
Modules: QueryMethods
Classes: QueriesArray
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#queries(&block) ⇒ Object
Also known as:
query
Returns the value of attribute queries.
30
31
32
|
# File 'lib/eson/search/queries.rb', line 30
def queries
@queries
end
|
Class Method Details
.register(name, klass) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/eson/search/queries.rb', line 32
def self.register(name, klass)
QueryMethods.__send__(:define_method, name) do |*args, &block|
o = klass.new(*args)
o.context = :query
o.args = self.args
o.instance_exec(o, &block) if block
queries << o
o
end
end
|
Instance Method Details
#queries? ⇒ Boolean
48
49
50
|
# File 'lib/eson/search/queries.rb', line 48
def queries?
@queries && !(@queries.empty?)
end
|
#to_query_hash ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/eson/search/queries.rb', line 52
def to_query_hash
others = super if defined?(super)
if queries?
{ :query => queries.to_query_hash }.tap do |h|
h.merge!(others) if others
end
else
others
end
end
|