sunspot_suggest 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -104,19 +104,21 @@ module Sunspot
|
|
104
104
|
end
|
105
105
|
|
106
106
|
|
107
|
-
def
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
def spellcheck_results
|
108
|
+
@spellcheck_results = begin
|
109
|
+
spellcheck = Spellcheck.new
|
110
|
+
|
111
|
+
raw_suggestions.each_slice(2) do |k, v|
|
112
|
+
if k == 'collation'
|
113
|
+
spellcheck.add_collation(v)
|
114
|
+
elsif k == 'correctlySpelled'
|
115
|
+
spellcheck.correctly_spelled = (v == 'true')
|
116
|
+
else
|
117
|
+
spellcheck.add_suggestion(k, v)
|
118
|
+
end
|
117
119
|
end
|
120
|
+
spellcheck
|
118
121
|
end
|
119
|
-
spellcheck
|
120
122
|
end
|
121
123
|
|
122
124
|
private
|
@@ -39,7 +39,7 @@ describe 'spellcheck', :type => :search do
|
|
39
39
|
spellcheck
|
40
40
|
end
|
41
41
|
|
42
|
-
spellcheck = result.
|
42
|
+
spellcheck = result.spellcheck_results
|
43
43
|
collations = spellcheck.collations
|
44
44
|
expect(collations.size).to eq(0)
|
45
45
|
|
@@ -104,7 +104,7 @@ describe 'spellcheck', :type => :search do
|
|
104
104
|
spellcheck
|
105
105
|
end
|
106
106
|
|
107
|
-
spelling_suggestions = result.
|
107
|
+
spelling_suggestions = result.spellcheck_results
|
108
108
|
collations = spelling_suggestions.collations
|
109
109
|
expect(collations.size).to eq(2)
|
110
110
|
expect(collations.first.query).to eq('markup_texts:(perform hvac)')
|