Class: Boolminot::ClauseFactory
- Inherits:
-
Logica::PredicateFactory
- Object
- Logica::PredicateFactory
- Boolminot::ClauseFactory
- Defined in:
- lib/boolminot/clause_factory.rb
Instance Method Summary collapse
- #exists(field, opts = {}) ⇒ Object
- #generic(type, body, opts = {}) ⇒ Object
- #geo_bounding_box(field, bounding_box, opts = {}) ⇒ Object
- #match_all ⇒ Object
- #match_none ⇒ Object
- #missing(field, opts = {}) ⇒ Object
- #nested(path, clause, opts = {}) ⇒ Object
- #query_string(parameters, opts = {}) ⇒ Object
- #range(field, bounds, opts = {}) ⇒ Object
- #script(script, opts = {}) ⇒ Object
- #term(field, value, opts = {}) ⇒ Object
- #terms(field, values, opts = {}) ⇒ Object
- #wildcard(field, expression, opts = {}) ⇒ Object
Instance Method Details
#exists(field, opts = {}) ⇒ Object
7 8 9 |
# File 'lib/boolminot/clause_factory.rb', line 7 def exists(field, opts = {}) generic(:exists, { field: field.to_sym }, opts) end |
#generic(type, body, opts = {}) ⇒ Object
3 4 5 |
# File 'lib/boolminot/clause_factory.rb', line 3 def generic(type, body, opts = {}) Clauses::Generic.new(type.to_sym, body, opts) end |
#geo_bounding_box(field, bounding_box, opts = {}) ⇒ Object
27 28 29 |
# File 'lib/boolminot/clause_factory.rb', line 27 def geo_bounding_box(field, bounding_box, opts = {}) generic(:geo_bounding_box, { field => bounding_box }, opts) end |
#match_all ⇒ Object
47 48 49 |
# File 'lib/boolminot/clause_factory.rb', line 47 def match_all tautology end |
#match_none ⇒ Object
51 52 53 |
# File 'lib/boolminot/clause_factory.rb', line 51 def match_none contradiction end |
#missing(field, opts = {}) ⇒ Object
11 12 13 |
# File 'lib/boolminot/clause_factory.rb', line 11 def missing(field, opts = {}) exists(field, opts).negated end |
#nested(path, clause, opts = {}) ⇒ Object
31 32 33 |
# File 'lib/boolminot/clause_factory.rb', line 31 def nested(path, clause, opts = {}) Clauses::Nested.new(path, clause, opts) end |
#query_string(parameters, opts = {}) ⇒ Object
39 40 41 |
# File 'lib/boolminot/clause_factory.rb', line 39 def query_string(parameters, opts = {}) generic(:query_string, parameters, opts) end |
#range(field, bounds, opts = {}) ⇒ Object
23 24 25 |
# File 'lib/boolminot/clause_factory.rb', line 23 def range(field, bounds, opts = {}) Clauses::Range.new(field, bounds, opts) end |
#script(script, opts = {}) ⇒ Object
35 36 37 |
# File 'lib/boolminot/clause_factory.rb', line 35 def script(script, opts = {}) generic(:script, { script: script }, opts) end |
#term(field, value, opts = {}) ⇒ Object
15 16 17 |
# File 'lib/boolminot/clause_factory.rb', line 15 def term(field, value, opts = {}) Clauses::Terms.new(field, [value], opts) end |
#terms(field, values, opts = {}) ⇒ Object
19 20 21 |
# File 'lib/boolminot/clause_factory.rb', line 19 def terms(field, values, opts = {}) Clauses::Terms.new(field, values, opts) end |
#wildcard(field, expression, opts = {}) ⇒ Object
43 44 45 |
# File 'lib/boolminot/clause_factory.rb', line 43 def wildcard(field, expression, opts = {}) generic(:wildcard, { field => expression }, opts) end |