From 7316b617a7df5d76a657918190e30f8fbdc62eb8 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 22 Jan 2014 02:05:12 -0800 Subject: [PATCH] Removed stop words in favor of common terms - closes #105 --- lib/searchkick/reindex.rb | 6 +++--- lib/searchkick/search.rb | 3 ++- test/match_test.rb | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/searchkick/reindex.rb b/lib/searchkick/reindex.rb index 0590132..e147528 100644 --- a/lib/searchkick/reindex.rb +++ b/lib/searchkick/reindex.rb @@ -101,17 +101,17 @@ module Searchkick tokenizer: "standard", # synonym should come last, after stemming and shingle # shingle must come before snowball - filter: ["standard", "lowercase", "asciifolding", "stop", "searchkick_index_shingle", "snowball"] + filter: ["standard", "lowercase", "asciifolding", "searchkick_index_shingle", "snowball"] }, searchkick_search: { type: "custom", tokenizer: "standard", - filter: ["standard", "lowercase", "asciifolding", "stop", "searchkick_search_shingle", "snowball"] + filter: ["standard", "lowercase", "asciifolding", "searchkick_search_shingle", "snowball"] }, searchkick_search2: { type: "custom", tokenizer: "standard", - filter: ["standard", "lowercase", "asciifolding", "stop", "snowball"] + filter: ["standard", "lowercase", "asciifolding", "snowball"] }, # https://github.com/leschenko/elasticsearch_autocomplete/blob/master/lib/elasticsearch_autocomplete/analyzers.rb searchkick_autocomplete_index: { diff --git a/lib/searchkick/search.rb b/lib/searchkick/search.rb index 840487e..aa90ffc 100644 --- a/lib/searchkick/search.rb +++ b/lib/searchkick/search.rb @@ -77,7 +77,8 @@ module Searchkick fields: [field], query: term, use_dis_max: false, - operator: operator + operator: operator, + cutoff_frequency: 0.001 } queries.concat [ {multi_match: shared_options.merge(boost: 10, analyzer: "searchkick_search")}, diff --git a/test/match_test.rb b/test/match_test.rb index 679100a..97ea2cb 100644 --- a/test/match_test.rb +++ b/test/match_test.rb @@ -139,4 +139,9 @@ class TestMatch < Minitest::Unit::TestCase assert_search "*", ["Product A", "Product B"] end + def test_to_be_or_not_to_be + store_names ["to be or not to be"] + assert_search "to be", ["to be or not to be"] + end + end -- libgit2 0.21.0