mwmitchell-rsolr-ext 0.9.5 → 0.9.6

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 CHANGED
@@ -1,6 +1,9 @@
1
1
  =RSolr::Ext
2
2
  A set of helper methods/modules to assist in building Solr queries and handling responses when using the RSolr library.
3
3
 
4
+ ==Related Resources & Projects
5
+ * {RSolr}[http://github.com/mwmitchell/rsolr]
6
+
4
7
  ==Requests
5
8
  To use the RSolr::Ext connection instead of the normal RSolr connection:
6
9
  solr = RSolr::Ext.connect
@@ -9,57 +12,61 @@ RSolr::Ext adds a #find and a #luke_admin method to the connection object.
9
12
 
10
13
  ===#luke
11
14
  The #luke method returns a Hash/Mash result of a /admin/luke?numTerms=0 request:
12
- solr.luke['index']
13
- solr.luke['fields']
14
- solr.luke['info']
15
+ luke_response = solr.luke
16
+ luke_response['index']
17
+ luke_response['fields']
18
+ luke_response['info']
19
+
15
20
 
16
21
  ===#find
17
22
  The #find method listens for certain keys. All other keys are ignored, allowing the ability to mix-and-match special keys with normal Solr param keys. The recognized keys are describe below.
18
23
 
19
- ====:page
20
- This maps to the Solr "start" param. The current "page" in the results set. RSolr::Ext handles the page-to-rows math for you.
21
24
 
22
- ====:per_page
23
- This maps to the Solr "rows" param. How many "pages" in the result.
25
+ :page - This maps to the Solr "start" param. The current "page" in the results set. RSolr::Ext handles the page-to-rows math for you.
26
+
27
+
28
+ :per_page - This maps to the Solr "rows" param. How many "pages" in the result.
29
+
30
+
31
+ :queries - This key maps to the Solr "q" param. Accepts a string, array or hash. When an array is used, each value is joined by a space. When a hash is used, the keys are used as Solr fields.
24
32
 
25
- ====:queries
26
- This key maps to the Solr "q" param. Accepts a string, array or hash. When an array is used, each value is joined by a space. When a hash is used, the keys are used as Solr fields.
27
- =====Examples
28
33
  * :queries => 'normal' BECOMES ?q=normal
29
34
  * :queries => ['one', 'two'] BECOMES ?q=one two
30
35
  * :queries => {:title=>'one'} BECOMES ?q=title:(one)
31
36
  * :queries => ['red', {:title=>'one'}] BECOMES ?q=red title:(one)
32
37
 
33
- ====:phrases
34
- This value is mapped to the Solr "q" param. When this key is used, the value will become double-quoted, creating a Solr "phrase" based query.
35
- =====Examples
38
+
39
+ :phrases - This value is mapped to the Solr "q" param. When this key is used, the value will become double-quoted, creating a Solr "phrase" based query.
40
+
36
41
  * :phrases => 'normal' BECOMES ?q="normal"
37
42
  * :phrases => ['one', 'two'] BECOMES ?q="one" "two"
38
43
  * :phrases => {:title=>'one'} BECOMES ?q=title:("one")
39
- * :phrases => ['red', {:title=>'one'}] BECOMES ?q="red" title:("one")
44
+ * :phrases => ['red', {:title=>'one'}] BECOMES ?q="red" title:("one")
45
+
46
+
47
+ :filters - The :filters key maps to the Solr :fq param. This has the same behavior as the :queries key, except it's for the :fq param.
40
48
 
41
- ====:filters
42
- The :filters key maps to the Solr :fq param. This has the same behavior as the :queries key, except it's for the :fq param.
43
- =====Examples
44
49
  * :filters => 'normal' BECOMES ?fq=normal
45
50
  * :filters => ['one', 'two'] BECOMES ?fq=one two
46
51
  * :filters => {:title=>'one'} BECOMES ?fq=title:(one)
47
52
  * :filters => ['red', {:title=>'one'}] BECOMES ?fq=red title:(one)
53
+
54
+
55
+ :phrase_filters - The :phrase_filters key maps to the Solr :fq param. This has the same behavior as the :phrases key, except it's for the :fq param.
48
56
 
49
- ====:phrase_filters
50
- The :phrase_filters key maps to the Solr :fq param. This has the same behavior as the :phrases key, except it's for the :fq param.
51
- =====Examples
52
57
  * :phrase_filters => 'normal' BECOMES ?fq="normal"
53
58
  * :phrase_filters => ['one', 'two'] BECOMES ?fq="one" "two"
54
59
  * :phrase_filters => {:title=>'one'} BECOMES ?fq=title:("one")
55
60
  * :phrase_filters => ['red', {:title=>'one'}] BECOMES ?fq="red" title:("one")
61
+
62
+
63
+ :facets - The :facets does a few different things. First, it sets the Solr param facet=true. It accepts a hash with a single key called :fields. This should be an array of field names to facet on.
56
64
 
57
- ====:facets
58
- The :facets does a few different things. First, it sets the Solr param facet=true. It accepts a hash with a single key called :fields. This should be an array of field names to facet on.
59
- =====Examples
60
65
  * :facets=>{:fields=>['cat', 'blah']} BECOMES ?facet=true&facet.field=cat&facet.field=blah
61
66
 
62
- ====Request Example
67
+
68
+
69
+ ==Request Example
63
70
  solr = RSolr::Ext.connect
64
71
  solr_params = {
65
72
  :page=>2,
@@ -68,15 +75,14 @@ The :facets does a few different things. First, it sets the Solr param facet=tru
68
75
  :filters=>['test', {:price=>(1..10)}],
69
76
  :phrase_filters=>{:manu=>['Apple']},
70
77
  :queries=>'ipod',
71
- :facets=>{:fields=>['cat', 'blah']}
78
+ :facets=>{:fields=>['cat', 'blah']},
79
+ :echoParams => 'EXPLICIT'
72
80
  }
73
-
74
- response = rsolr.find(solr_params)
81
+ response = rsolr.find solr_params
75
82
 
76
83
  ==Responses
77
84
  RSolr::Ext decorates the normal output hash from RSolr and adds some helpful methods.
78
-
79
- ===Examples
85
+
80
86
  solr = RSolr::Ext.connect
81
87
 
82
88
  response = solr.find :q=>'*:*'
@@ -12,9 +12,12 @@ module RSolr::Ext::Connection
12
12
  # mappings are available (everything else gets passed to solr).
13
13
  # Returns a new RSolr::Ext::Response::Base object.
14
14
  def find *args
15
+ # remove the handler arg - the first, if it is a string OR set default
15
16
  path = args.first.is_a?(String) ? args.shift : '/select'
16
- params = args.pop || {}
17
- response = self.request path, RSolr::Ext::Request.map(params)
17
+ # remove the params - the first, if it is a Hash OR set default
18
+ params = args.first.kind_of?(Hash) ? args.shift : {}
19
+ # send path, map params and send the rest of the args along
20
+ response = self.request path, RSolr::Ext::Request.map(params), *args
18
21
  RSolr::Ext::Response::Base.new(response)
19
22
  end
20
23
 
data/rsolr-ext.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rsolr-ext"
3
- s.version = "0.9.5"
4
- s.date = "2009-09-04"
3
+ s.version = "0.9.6"
4
+ s.date = "2009-09-12"
5
5
  s.summary = "An extension lib for RSolr"
6
6
  s.email = "goodieboy@gmail.com"
7
7
  s.homepage = "http://github.com/mwmitchell/rsolr_ext"
@@ -9,25 +9,16 @@ Gem::Specification.new do |s|
9
9
  s.has_rdoc = true
10
10
  s.authors = ["Matt Mitchell"]
11
11
  s.files = [
12
-
13
12
  "lib/mash.rb",
14
-
15
13
  "lib/rsolr-ext/connection.rb",
16
-
17
14
  "lib/rsolr-ext/doc.rb",
18
-
19
15
  "lib/rsolr-ext/model.rb",
20
-
21
16
  "lib/rsolr-ext/request.rb",
22
-
23
17
  "lib/rsolr-ext/response/docs.rb",
24
18
  "lib/rsolr-ext/response/facets.rb",
25
19
  "lib/rsolr-ext/response/spelling.rb",
26
-
27
20
  "lib/rsolr-ext/response.rb",
28
-
29
21
  "lib/rsolr-ext.rb",
30
-
31
22
  "LICENSE",
32
23
  "README.rdoc",
33
24
  "rsolr-ext.gemspec"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mwmitchell-rsolr-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-04 00:00:00 -07:00
12
+ date: 2009-09-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,6 @@ files:
47
47
  - rsolr-ext.gemspec
48
48
  has_rdoc: true
49
49
  homepage: http://github.com/mwmitchell/rsolr_ext
50
- licenses:
51
50
  post_install_message:
52
51
  rdoc_options: []
53
52
 
@@ -68,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
67
  requirements: []
69
68
 
70
69
  rubyforge_project:
71
- rubygems_version: 1.3.5
70
+ rubygems_version: 1.2.0
72
71
  signing_key:
73
72
  specification_version: 2
74
73
  summary: An extension lib for RSolr