This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

[#289] Added an example of fuzzy query in the Text query integration …

…test

This is what you probably want to use when exposing the search interface to your users.

See <http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html>
  • Loading branch information...
karmi committed Mar 26, 2012
1 parent 6cde66e commit 137c981cda7de5cb755cb43f342bca578739a592
Showing with 13 additions and 1 deletion.
  1. +13 −1 test/integration/text_query_test.rb
@@ -9,17 +9,29 @@ class QueryStringIntegrationTest < Test::Unit::TestCase
setup do
Tire.index('articles-test') do
store :type => 'article', :title => '+1 !!!'
store :type => 'article', :title => 'Furry Kitten'
refresh
end
end
should "find article by title" do
results = Tire.search('articles-test') { query { text :title, '+1' } }.results
results = Tire.search('articles-test') do
query { text :title, '+1' }
end.results
assert_equal 1, results.count
assert_equal "+1 !!!", results.first[:title]
end
should "allow to pass options (fuzziness)" do
results = Tire.search('articles-test') do
query { text :title, 'fuzzy mitten', :fuzziness => 0.5, :operator => 'and' }
end.results
assert_equal 1, results.count
assert_equal "Furry Kitten", results.first[:title]
end
end
end

0 comments on commit 137c981

Please sign in to comment.