mwmitchell-rsolr-ext 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +6 -4
- data/lib/rsolr-ext.rb +1 -1
- data/lib/rsolr-ext/findable.rb +9 -8
- data/rsolr-ext.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -47,14 +47,16 @@ The object returned is an RSolr::Connection::Adapter (Direct or HTTP) with addit
|
|
47
47
|
|
48
48
|
The #find method provides a convenient way to search solr. Here are some examples:
|
49
49
|
|
50
|
+
solr = RSolr::Ext.connect
|
51
|
+
|
50
52
|
# q=jefferson - returns all docs
|
51
|
-
all_jefferson_docs = find 'jefferson'
|
53
|
+
all_jefferson_docs = solr.find 'jefferson'
|
52
54
|
|
53
55
|
# q=jefferson&rows=1 -- first doc only
|
54
|
-
a_single_jefferson_doc = find :first, 'jefferson'
|
56
|
+
a_single_jefferson_doc = solr.find :first, 'jefferson'
|
55
57
|
|
56
58
|
# q=jefferson&fq=type:"book" - all docs
|
57
|
-
books_about_jefferson = find 'jefferson', :phrase_filters=>{:type=>'book'}
|
59
|
+
books_about_jefferson = solr.find 'jefferson', :phrase_filters=>{:type=>'book'}
|
58
60
|
|
59
61
|
# q=something -- the entire response
|
60
|
-
solr_response = find {:q=>'something'}, :include_response=>true
|
62
|
+
solr_response = solr.find {:q=>'something'}, :include_response=>true
|
data/lib/rsolr-ext.rb
CHANGED
data/lib/rsolr-ext/findable.rb
CHANGED
@@ -54,15 +54,16 @@ module RSolr::Ext::Findable
|
|
54
54
|
response['response']['docs'][i] = yield(doc)
|
55
55
|
end
|
56
56
|
end
|
57
|
-
if
|
58
|
-
# return only one doc
|
59
|
-
response['response']['docs'].first
|
60
|
-
elsif opts[:include_response] == false
|
61
|
-
# return all docs
|
62
|
-
response['response']['docs']
|
63
|
-
else
|
64
|
-
# return the entire response
|
57
|
+
if opts[:include_response] == true
|
65
58
|
response
|
59
|
+
else
|
60
|
+
if mode == :first
|
61
|
+
# return only one doc
|
62
|
+
response['response']['docs'].first
|
63
|
+
else
|
64
|
+
# return all docs
|
65
|
+
response['response']['docs']
|
66
|
+
end
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
data/rsolr-ext.gemspec
CHANGED