Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/sensei/query.rb
Instance Method Summary collapse
Instance Method Details
#to_sensei(field, op = :should) ⇒ Object
219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/sensei/query.rb', line 219 def to_sensei(field, op=:should) if op == :should if self.length == 1 Sensei::TermQuery.new(:field => field, :value => self.first) else Sensei::TermsQuery.new(:field => field, :values => self) end else Sensei::BoolQuery.new(:operation => op, :operands => self.map{|value| {field => value}.to_sensei}) end end |