mwmitchell-rsolr 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +9 -0
- data/lib/rsolr.rb +1 -1
- data/lib/rsolr/response/query.rb +15 -0
- metadata +1 -1
data/CHANGES.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.6.6 - January 26, 2009
|
2
|
+
Added #get method helper to RSolr::Response::Query::DocExt
|
3
|
+
# doc.get(key, opts)
|
4
|
+
# key is the name of the field
|
5
|
+
# opts is a hash with the following valid keys:
|
6
|
+
# - :sep - a string used for joining multivalued field values
|
7
|
+
# - :default - a value to return when the key doesn't exist
|
8
|
+
# if :sep is nil and the field is a multivalued field, the array is returned
|
9
|
+
|
1
10
|
0.6.5 - January 26, 2009
|
2
11
|
Removed to_mash everywhere, except for usage in RSolr::Response
|
3
12
|
Added a #close method to the Direct adapter
|
data/lib/rsolr.rb
CHANGED
data/lib/rsolr/response/query.rb
CHANGED
@@ -23,6 +23,21 @@ module RSolr::Response::Query
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
# helper
|
27
|
+
# key is the name of the field
|
28
|
+
# opts is a hash with the following valid keys:
|
29
|
+
# - :sep - a string used for joining multivalued field values
|
30
|
+
# - :default - a value to return when the key doesn't exist
|
31
|
+
# if :sep is nil and the field is a multivalued field, the array is returned
|
32
|
+
def get(key, opts={:sep=>', ', :default=>nil})
|
33
|
+
if self.key? key
|
34
|
+
val = self[key]
|
35
|
+
(val.is_a?(Array) and opts[:sep]) ? val.join(opts[:sep]) : val
|
36
|
+
else
|
37
|
+
opts[:default]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
26
41
|
end
|
27
42
|
|
28
43
|
# from the delsolr project -> http://github.com/avvo/delsolr/tree/master/lib/delsolr/response.rb
|