Skip to content

Commit

Permalink
No longer require synonyms to be lowercase - #912
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 3, 2017
1 parent 1fb35cc commit 1cc4007
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
## 2.2.2 [unreleased]

- Added `queue_name` option
- No longer require synonyms to be lowercase

## 2.2.1

Expand Down
2 changes: 1 addition & 1 deletion lib/searchkick/index_options.rb
Expand Up @@ -167,7 +167,7 @@ def index_options
if synonyms.any?
settings[:analysis][:filter][:searchkick_synonym] = {
type: "synonym",
synonyms: synonyms.select { |s| s.size > 1 }.map { |s| s.is_a?(Array) ? s.join(",") : s }
synonyms: synonyms.select { |s| s.size > 1 }.map { |s| s.is_a?(Array) ? s.join(",") : s }.map(&:downcase)
}
# choosing a place for the synonym filter when stemming is not easy
# https://groups.google.com/forum/#!topic/elasticsearch/p7qcQlgHdB8
Expand Down
5 changes: 5 additions & 0 deletions test/synonyms_test.rb
Expand Up @@ -59,4 +59,9 @@ def test_directional
assert_search "Halogen Lamp", ["Lightbulb"]
assert_search "onions", ["Green Onions"]
end

def test_case
store_names ["Uppercase"]
assert_search "lowercase", ["Uppercase"]
end
end
1 change: 1 addition & 0 deletions test/test_helper.rb
Expand Up @@ -372,6 +372,7 @@ class Product
["qtip", "cottonswab"],
["burger", "hamburger"],
["bandaid", "bandag"],
["UPPERCASE", "lowercase"],
"lightbulb => led,lightbulb",
"lightbulb => halogenlamp"
],
Expand Down

0 comments on commit 1cc4007

Please sign in to comment.