module Boolminot::Clauses::Base::InstanceMethods

Public Instance Methods

satisfied_by?(document) click to toggle source
# File lib/boolminot/clauses/base.rb, line 11
def satisfied_by?(document)
  raise NoMethodError, 'Sorry; Boolminot clauses do not act as percolators'
end
to_elasticsearch(options = {}) click to toggle source
# File lib/boolminot/clauses/base.rb, line 15
def to_elasticsearch(options = {})
  default_options = {
    context: :filter
  }
  options = default_options.merge(options)

  send "to_elasticsearch_in_#{options[:context]}_context"
end
to_elasticsearch_negated(options = {}) click to toggle source
# File lib/boolminot/clauses/base.rb, line 24
def to_elasticsearch_negated(options = {})
  { bool: { must_not: [to_elasticsearch(options)] } }
end
to_raw_bool(options = {}) click to toggle source
# File lib/boolminot/clauses/base.rb, line 28
def to_raw_bool(options = {})
  { bool: { must: [to_elasticsearch(options)] } }
end

Protected Instance Methods

terms_with_field?(field) click to toggle source
# File lib/boolminot/clauses/base.rb, line 34
def terms_with_field?(field)
  false
end

Private Instance Methods

clause_factory() click to toggle source
# File lib/boolminot/clauses/base.rb, line 56
def clause_factory
  predicate_factory
end
opts() click to toggle source
# File lib/boolminot/clauses/base.rb, line 52
def opts
  {}
end
to_elasticsearch_in_filter_context() click to toggle source
# File lib/boolminot/clauses/base.rb, line 48
def to_elasticsearch_in_filter_context
  { type => body.merge(opts) }
end
to_elasticsearch_in_query_context() click to toggle source
# File lib/boolminot/clauses/base.rb, line 44
def to_elasticsearch_in_query_context
  to_elasticsearch_in_filter_context
end
type() click to toggle source
# File lib/boolminot/clauses/base.rb, line 40
def type
  OpenHouse.simple_inflector.underscored_demodulized(self.class.name).to_sym
end