supernova 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/supernova/solr_criteria.rb +9 -7
- data/spec/supernova/solr_criteria_spec.rb +4 -0
- data/supernova.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
@@ -66,14 +66,16 @@ class Supernova::SolrCriteria < Supernova::Criteria
|
|
66
66
|
if with.blank?
|
67
67
|
[]
|
68
68
|
else
|
69
|
-
with.map do |key_or_condition,
|
70
|
-
|
71
|
-
key_or_condition.
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
with.map do |key_or_condition, values|
|
70
|
+
[values].flatten.map do |value|
|
71
|
+
if key_or_condition.respond_to?(:solr_filter_for)
|
72
|
+
key_or_condition.key = solr_field_from_field(key_or_condition.key)
|
73
|
+
key_or_condition.solr_filter_for(value)
|
74
|
+
else
|
75
|
+
fq_filter_for_key_and_value(solr_field_from_field(key_or_condition), value)
|
76
|
+
end
|
75
77
|
end
|
76
|
-
end
|
78
|
+
end.flatten
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
@@ -177,6 +177,10 @@ describe Supernova::SolrCriteria do
|
|
177
177
|
criteria.attribute_mapping(:artist_name => { :type => :string }).where(:artist_name => "test").to_params[:fq].should == ["artist_name_s:test"]
|
178
178
|
end
|
179
179
|
|
180
|
+
it "accepts arrays as filters in where" do
|
181
|
+
criteria.attribute_mapping(:artist_name => { :type => :string }).where(:artist_name => %w(hans maulwurf)).to_params[:fq].should == ["artist_name_s:hans", "artist_name_s:maulwurf"]
|
182
|
+
end
|
183
|
+
|
180
184
|
it "uses the mapped fields for all criteria queries" do
|
181
185
|
criteria.attribute_mapping(:artist_name => { :type => :string }).where(:artist_name.ne => nil).to_params[:fq].should == ["artist_name_s:[* TO *]"]
|
182
186
|
end
|
data/supernova.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supernova
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Schwab
|