class Boolminot::ClauseFactory

Public Instance Methods

exists(field, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 7
def exists(field, opts = {})
  generic(:exists, { field: field.to_sym }, opts)
end
generic(type, body, opts = {}) click to toggle source
# 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 = {}) click to toggle source
# 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() click to toggle source
# File lib/boolminot/clause_factory.rb, line 47
def match_all
  tautology
end
match_none() click to toggle source
# File lib/boolminot/clause_factory.rb, line 51
def match_none
  contradiction
end
missing(field, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 11
def missing(field, opts = {})
  exists(field, opts).negated
end
nested(path, clause, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 31
def nested(path, clause, opts = {})
  Clauses::Nested.new(path, clause, opts)
end
query_string(parameters, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 39
def query_string(parameters, opts = {})
  generic(:query_string, parameters, opts)
end
range(field, bounds, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 23
def range(field, bounds, opts = {})
  Clauses::Range.new(field, bounds, opts)
end
script(script, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 35
def script(script, opts = {})
  generic(:script, { script: script }, opts)
end
term(field, value, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 15
def term(field, value, opts = {})
  Clauses::Terms.new(field, [value], opts)
end
terms(field, values, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 19
def terms(field, values, opts = {})
  Clauses::Terms.new(field, values, opts)
end
wildcard(field, expression, opts = {}) click to toggle source
# File lib/boolminot/clause_factory.rb, line 43
def wildcard(field, expression, opts = {})
  generic(:wildcard, { field => expression }, opts)
end

Private Instance Methods

at_least_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 69
def at_least_class
  Clauses::Compounds::AtLeast
end
conjunction_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 61
def conjunction_class
  Clauses::Compounds::Conjunction
end
contradiction_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 77
def contradiction_class
  Clauses::MatchNone
end
disjunction_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 65
def disjunction_class
  Clauses::Compounds::Disjunction
end
negation_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 57
def negation_class
  Clauses::Negation
end
tautology_class() click to toggle source
# File lib/boolminot/clause_factory.rb, line 73
def tautology_class
  Clauses::MatchAll
end