mwmitchell-rsolr-ext 0.5.7 → 0.5.8

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,8 @@
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
+ NOTE: The API for RSolr::Ext is pre 1.0. Things are be changing!
5
+
4
6
  ==Request Example
5
7
  std = RSolr::Ext::Request::Standard.new
6
8
 
@@ -23,9 +25,9 @@ A set of helper methods/modules to assist in building Solr queries and handling
23
25
  raw_response = rsolr.select(:q=>'*:*)
24
26
  r = RSolr::Ext::Response::Standard.new(raw_response)
25
27
 
26
- r.response_header.params
27
- r.response.docs
28
- r.response.docs.previous_page
28
+ r.header[:params]
29
+ r.response[:docs]
30
+ r.response[:docs].previous_page
29
31
 
30
32
  ===Doc Pagination
31
33
  After creating a RSolr::Ext::Response object, pass-in the response.docs to the will_paginate view helper:
@@ -33,4 +35,4 @@ After creating a RSolr::Ext::Response object, pass-in the response.docs to the w
33
35
  raw_response = rsolr.select(:q=>'*:*)
34
36
  @response = RSolr::Ext::Response::Standard.new(raw_response)
35
37
  # in view:
36
- <%= will_paginate @response.response.docs %>
38
+ <%= will_paginate @response.response[:docs] %>
data/lib/rsolr-ext.rb CHANGED
@@ -15,7 +15,7 @@ module RSolr
15
15
 
16
16
  module Ext
17
17
 
18
- VERSION = '0.5.7'
18
+ VERSION = '0.5.8'
19
19
 
20
20
  autoload :Request, 'rsolr-ext/request.rb'
21
21
  autoload :Response, 'rsolr-ext/response.rb'
@@ -38,7 +38,7 @@ module RSolr::Ext::Mapable
38
38
  def append_to_param(existing_value, new_value, auto_join=true)
39
39
  values = [existing_value, new_value]
40
40
  values.delete_if{|v|v.nil?}
41
- auto_join ? values.join(' ') : values
41
+ auto_join ? values.join(' ') : values.flatten
42
42
  end
43
43
 
44
44
  end
@@ -32,11 +32,11 @@ module RSolr::Ext::Request
32
32
  end
33
33
 
34
34
  def map_filters(value,output)
35
- output[:fq] = append_to_param(output[:fq], build_query(value))
35
+ output[:fq] = append_to_param(output[:fq], build_query(value), false)
36
36
  end
37
37
 
38
38
  def map_phrase_filters(value,output)
39
- output[:fq] = append_to_param(output[:fq], build_query(value, true))
39
+ output[:fq] = append_to_param(output[:fq], build_query(value, true), false)
40
40
  end
41
41
 
42
42
  def map_facets(value,output)
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.5.7"
3
+ s.version = "0.5.8"
4
4
  s.date = "2009-03-18"
5
5
  s.summary = "An extension lib for RSolr"
6
6
  s.email = "goodieboy@gmail.com"
data/test/request_test.rb CHANGED
@@ -14,7 +14,7 @@ class RSolrExtRequestTest < Test::Unit::TestCase
14
14
  :q=>'ipod',
15
15
  :facets=>{:fields=>['cat', 'blah']}
16
16
  )
17
- assert_equal "test price:[1 TO 10] manu:\"Apple\"", solr_params[:fq]
17
+ assert_equal ["test", "price:[1 TO 10]", "manu:\"Apple\""], solr_params[:fq]
18
18
  assert_equal 10, solr_params[:start]
19
19
  assert_equal 10, solr_params[:rows]
20
20
  assert_equal "ipod name:\"This is a phrase\"", solr_params[:q]
@@ -22,4 +22,13 @@ class RSolrExtRequestTest < Test::Unit::TestCase
22
22
  assert_equal true, solr_params[:facet]
23
23
  end
24
24
 
25
+ test 'fq param using the phrase_filters mapping' do
26
+ std = RSolr::Ext::Request::Standard.new
27
+ solr_params = std.map(
28
+ :phrase_filters=>[{:manu=>'Apple'}, {:color=>'red'}]
29
+ )
30
+ assert solr_params[:fq].is_a?(Array)
31
+ assert solr_params[:fq].first.is_a?(String)
32
+ end
33
+
25
34
  end
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.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell