mwmitchell-rsolr-ext 0.7.33 → 0.7.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rsolr-ext/response/spelling.rb +5 -9
- data/lib/rsolr-ext.rb +1 -1
- data/rsolr-ext.gemspec +1 -1
- metadata +1 -1
@@ -24,11 +24,10 @@ module RSolr::Ext::Response::Spelling
|
|
24
24
|
# Thanks to Naomi Dushay!
|
25
25
|
def words
|
26
26
|
@words ||= (
|
27
|
+
result = []
|
27
28
|
spellcheck = self.response[:spellcheck]
|
28
|
-
if spellcheck && spellcheck[:suggestions]
|
29
|
-
|
30
|
-
result = Array.new
|
31
|
-
if (!suggestions.nil?)
|
29
|
+
if spellcheck && (suggestions = spellcheck[:suggestions])
|
30
|
+
unless suggestions.nil?
|
32
31
|
# suggestions is an array:
|
33
32
|
# (query term)
|
34
33
|
# (hash of term info and term suggestion)
|
@@ -52,14 +51,11 @@ module RSolr::Ext::Response::Spelling
|
|
52
51
|
# suggestion => { frequency =>, word => }
|
53
52
|
origFreq = term_info['origFreq']
|
54
53
|
suggFreq = term_info['suggestion']['frequency']
|
55
|
-
if suggFreq > origFreq
|
56
|
-
result.push(term_info['suggestion']['word'])
|
57
|
-
end
|
54
|
+
words << term_info['suggestion']['word'] if suggFreq > origFreq
|
58
55
|
end
|
59
|
-
result.uniq!
|
60
|
-
result.empty? ? nil : result
|
61
56
|
end
|
62
57
|
end
|
58
|
+
words.uniq
|
63
59
|
)
|
64
60
|
end
|
65
61
|
|
data/lib/rsolr-ext.rb
CHANGED
data/rsolr-ext.gemspec
CHANGED