class ChefZero::Solr::Query::UnaryOperator
Attributes
operand[R]
operator[R]
Public Class Methods
new(operator, operand)
click to toggle source
# File lib/chef_zero/solr/query/unary_operator.rb, line 5 def initialize(operator, operand) @operator = operator @operand = operand end
Public Instance Methods
matches_doc?(doc)
click to toggle source
# File lib/chef_zero/solr/query/unary_operator.rb, line 17 def matches_doc?(doc) case @operator when '-' when 'NOT' !operand.matches_doc?(doc) when '+' # TODO This operator uses relevance to eliminate other, unrelated # expressions. +a OR b means "if it has b but not a, don't return it" raise "+ not supported yet, because it is hard." end end
matches_values?(values)
click to toggle source
# File lib/chef_zero/solr/query/unary_operator.rb, line 29 def matches_values?(values) case @operator when '-' when 'NOT' !operand.matches_values?(values) when '+' # TODO This operator uses relevance to eliminate other, unrelated # expressions. +a OR b means "if it has b but not a, don't return it" raise "+ not supported yet, because it is hard." end end
to_s()
click to toggle source
# File lib/chef_zero/solr/query/unary_operator.rb, line 10 def to_s "#{operator} #{operand}" end