outoftime-sunspot 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/sunspot/query/restriction.rb +6 -6
- data/spec/api/build_search_spec.rb +12 -0
- metadata +1 -1
data/VERSION.yml
CHANGED
@@ -136,15 +136,15 @@ module Sunspot
|
|
136
136
|
unless @value.nil?
|
137
137
|
super
|
138
138
|
else
|
139
|
-
"
|
139
|
+
"#{escape(@field.indexed_name)}:[* TO *]"
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
144
|
-
|
145
|
-
super
|
143
|
+
def negated?
|
144
|
+
if @value.nil?
|
145
|
+
!super
|
146
146
|
else
|
147
|
-
|
147
|
+
super
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -225,7 +225,7 @@ module Sunspot
|
|
225
225
|
end
|
226
226
|
|
227
227
|
def negate
|
228
|
-
SameAs.new(@object,
|
228
|
+
SameAs.new(@object, !negated?)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
end
|
@@ -383,6 +383,18 @@ describe 'Search' do
|
|
383
383
|
)
|
384
384
|
end
|
385
385
|
|
386
|
+
it 'should create a disjunction with empty restriction' do
|
387
|
+
session.search Post do
|
388
|
+
any_of do
|
389
|
+
with(:average_rating, nil)
|
390
|
+
with(:average_rating).greater_than(3.0)
|
391
|
+
end
|
392
|
+
end
|
393
|
+
connection.should have_last_search_with(
|
394
|
+
:fq => '-(average_rating_f:[* TO *] AND -average_rating_f:[3\.0 TO *])'
|
395
|
+
)
|
396
|
+
end
|
397
|
+
|
386
398
|
it 'should restrict by dynamic string field with equality restriction' do
|
387
399
|
session.search Post do
|
388
400
|
dynamic :custom_string do
|