rsolr-ext 0.9.6.3 → 0.9.6.4
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 +4 -0
- data/lib/rsolr-ext/request.rb +1 -1
- data/lib/rsolr-ext/response/facets.rb +5 -17
- data/rsolr-ext.gemspec +1 -1
- data/test/request_test.rb +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,10 @@
|
|
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
|
+
== Installation:
|
5
|
+
gem sources -a http://gemcutter.org
|
6
|
+
sudo gem install rsolr-ext
|
7
|
+
|
4
8
|
==Related Resources & Projects
|
5
9
|
* {RSolr}[http://github.com/mwmitchell/rsolr]
|
6
10
|
|
data/lib/rsolr-ext/request.rb
CHANGED
@@ -9,31 +9,19 @@ module RSolr::Ext::Response::Facets
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# @response.facets.each do |facet|
|
12
|
-
# facet.
|
12
|
+
# facet.name
|
13
|
+
# facet.items
|
13
14
|
# end
|
14
15
|
# "caches" the result in the @facets instance var
|
15
16
|
def facets
|
16
|
-
# memoize!
|
17
17
|
@facets ||= (
|
18
|
-
|
18
|
+
facet_fields.map do |(facet_field_name,values_and_hits)|
|
19
19
|
facet = FacetField.new(facet_field_name)
|
20
|
-
|
21
|
-
|
22
|
-
while value = values_and_hits_list.shift
|
23
|
-
# and then shift off the next to get the hit value
|
24
|
-
facet.items << FacetItem.new(value, values_and_hits_list.shift)
|
25
|
-
# repeat until there are no more pairs in the values_and_hits_list array
|
20
|
+
(values_and_hits.size/2).times do |index|
|
21
|
+
facet.items << FacetItem.new(values_and_hits[index*2], values_and_hits[index*2+1])
|
26
22
|
end
|
27
23
|
facet
|
28
24
|
end
|
29
|
-
#all.extend RSolr::Ext::Response::Docs::Pageable
|
30
|
-
#all.start = header['params']['facet.offset'].to_s.to_i
|
31
|
-
#all.per_page = header['params']['facet.limit'].to_s.to_i - 1
|
32
|
-
#all.total = -1
|
33
|
-
## override the has_next? method -- when paging through facets,
|
34
|
-
## it's not possible to know how many "pages" there are
|
35
|
-
#all.instance_eval "def has_next?; #{all.size == all.per_page+1} end"
|
36
|
-
all
|
37
25
|
)
|
38
26
|
end
|
39
27
|
|
data/rsolr-ext.gemspec
CHANGED
data/test/request_test.rb
CHANGED
@@ -5,8 +5,8 @@ class RSolrExtRequestTest < Test::Unit::TestCase
|
|
5
5
|
|
6
6
|
test 'standard request' do
|
7
7
|
solr_params = RSolr::Ext::Request.map(
|
8
|
-
:page=>2,
|
9
|
-
:per_page=>10,
|
8
|
+
:page=>'2',
|
9
|
+
:per_page=>'10',
|
10
10
|
:phrases=>{:name=>'This is a phrase'},
|
11
11
|
:filters=>['test', {:price=>(1..10)}],
|
12
12
|
:phrase_filters=>{:manu=>['Apple']},
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsolr-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.6.
|
4
|
+
version: 0.9.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Mitchell
|
@@ -13,7 +13,7 @@ date: 2009-09-30 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: rsolr
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements: []
|
70
70
|
|
71
71
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.3.
|
72
|
+
rubygems_version: 1.3.5
|
73
73
|
signing_key:
|
74
74
|
specification_version: 3
|
75
75
|
summary: An extension lib for RSolr
|