Skip to content
This repository
Browse code

Allow options for the `terms` query

Closes: #643
  • Loading branch information...
commit 8db77cdf0cf67eae36e73e8b22718045fb1c5b43 1 parent 89439ea
authored February 26, 2013 karmi committed March 27, 2013
2  lib/tire/search/query.rb
@@ -20,7 +20,7 @@ def term(field, value, options={})
20 20
 
21 21
       def terms(field, value, options={})
22 22
         @value = { :terms => { field => value } }
23  
-        @value[:terms].update( { :minimum_match => options[:minimum_match] } ) if options[:minimum_match]
  23
+        @value[:terms].update(options)
24 24
         @value
25 25
       end
26 26
 
5  test/unit/search_query_test.rb
@@ -55,6 +55,11 @@ class QueryTest < Test::Unit::TestCase
55 55
         assert_equal( { :terms => { :foo => ['bar', 'baz'], :minimum_match => 2 } },
56 56
                       Query.new.terms(:foo, ['bar', 'baz'], :minimum_match => 2) )
57 57
       end
  58
+
  59
+      should "allow set boost when searching for multiple terms" do
  60
+        assert_equal( { :terms => { :foo => ['bar', 'baz'], :boost => 2 } },
  61
+                      Query.new.terms(:foo, ['bar', 'baz'], :boost => 2) )
  62
+      end
58 63
     end
59 64
 
60 65
     context "Range query" do

0 notes on commit 8db77cd

Please sign in to comment.
Something went wrong with that request. Please try again.