rsolr-ext 0.9.6.3 → 0.9.6.4

Sign up to get free protection for your applications and to get access to all the features.
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
 
@@ -5,7 +5,7 @@ module RSolr::Ext::Request
5
5
  def map input
6
6
  output = {}
7
7
  if input[:per_page]
8
- output[:rows] = input.delete :per_page
8
+ output[:rows] = input.delete(:per_page).to_i
9
9
  end
10
10
 
11
11
  if page = input.delete(:page)
@@ -9,31 +9,19 @@ module RSolr::Ext::Response::Facets
9
9
  end
10
10
 
11
11
  # @response.facets.each do |facet|
12
- # facet.field
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
- all = facet_fields.collect do |(facet_field_name,values_and_hits_list)|
18
+ facet_fields.map do |(facet_field_name,values_and_hits)|
19
19
  facet = FacetField.new(facet_field_name)
20
- # the values_and_hits_list is an array where a value is immediately followed by it's hit count
21
- # so we shift off an item (the value)
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rsolr-ext"
3
- s.version = "0.9.6.3"
3
+ s.version = "0.9.6.4"
4
4
  s.date = "2009-09-30"
5
5
 
6
6
  s.summary = "An extension lib for RSolr"
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.3
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: mwmitchell-rsolr
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.4
72
+ rubygems_version: 1.3.5
73
73
  signing_key:
74
74
  specification_version: 3
75
75
  summary: An extension lib for RSolr