sunspot_matchers 1.2.1.1 → 1.2.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -143,8 +143,10 @@ module SunspotMatchers
|
|
143
143
|
|
144
144
|
def get_matcher
|
145
145
|
case @method
|
146
|
-
when :with
|
146
|
+
when :with
|
147
147
|
WithMatcher
|
148
|
+
when :without
|
149
|
+
WithoutMatcher
|
148
150
|
when :keywords
|
149
151
|
KeywordsMatcher
|
150
152
|
when :boost
|
@@ -173,6 +175,16 @@ module SunspotMatchers
|
|
173
175
|
end
|
174
176
|
end
|
175
177
|
|
178
|
+
class WithoutMatcher < BaseMatcher
|
179
|
+
def search_method
|
180
|
+
:without
|
181
|
+
end
|
182
|
+
|
183
|
+
def keys_to_compare
|
184
|
+
[:fq]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
176
188
|
class KeywordsMatcher < BaseMatcher
|
177
189
|
def search_method
|
178
190
|
:keywords
|
@@ -215,6 +215,13 @@ describe "Sunspot Matchers" do
|
|
215
215
|
Sunspot.session.should_not have_search_params(:without, :author_name, 'John Twain')
|
216
216
|
end
|
217
217
|
|
218
|
+
it "should not match a with search" do
|
219
|
+
Sunspot.search(Post) do
|
220
|
+
with :author_name, 'Mark Twain'
|
221
|
+
end
|
222
|
+
Sunspot.session.should_not have_search_params(:without, :author_name, 'Mark Twain')
|
223
|
+
end
|
224
|
+
|
218
225
|
it "should match for multiple without" do
|
219
226
|
Sunspot.search(Post) do
|
220
227
|
without :author_name, 'Mark Twain'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunspot_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 79
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
9
|
- 1
|
10
|
-
-
|
11
|
-
version: 1.2.1.
|
10
|
+
- 2
|
11
|
+
version: 1.2.1.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Joseph Palermo
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-22 00:00:00 +08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|