rsolr-ext 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,9 @@ module RSolr::Ext::Request
2
2
 
3
3
  module Params
4
4
 
5
- def map input
5
+ def map input_params
6
+ input = input_params.dup
7
+
6
8
  output = {}
7
9
 
8
10
  if input[:per_page]
@@ -16,6 +18,10 @@ module RSolr::Ext::Request
16
18
  output[:start] = page * output[:rows]
17
19
  end
18
20
 
21
+ # remove the input :q params
22
+ output[:q] = input.delete :q
23
+ output[:fq] = input.delete :fq
24
+
19
25
  if queries = input.delete(:queries)
20
26
  output[:q] = append_to_param output[:q], build_query(queries, false)
21
27
  end
data/rsolr-ext.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = "rsolr-ext"
4
- s.version = "0.11.1"
5
- s.date = "2009-11-19"
4
+ s.version = "0.11.2"
5
+ s.date = "2010-01-07"
6
6
 
7
7
  s.summary = "An extension lib for RSolr"
8
8
  s.email = "goodieboy@gmail.com"
data/test/request_test.rb CHANGED
@@ -23,8 +23,28 @@ class RSolrExtRequestTest < Test::Unit::TestCase
23
23
  solr_params = RSolr::Ext::Request.map(
24
24
  :phrase_filters=>{:manu=>['Apple', 'ASG'], :color=>['red', 'blue']}
25
25
  )
26
- expected = {:fq=>["color:\"red\"", "color:\"blue\"", "manu:\"Apple\"", "manu:\"ASG\""]}
27
- assert expected, solr_params
26
+
27
+ assert_equal 4, solr_params[:fq].size
28
+ assert solr_params[:fq].include?("color:\"red\"")
29
+ assert solr_params[:fq].include?("color:\"blue\"")
30
+ assert solr_params[:fq].include?("manu:\"Apple\"")
31
+ assert solr_params[:fq].include?("manu:\"ASG\"")
32
+
33
+ end
34
+
35
+ test ':filters and :phrase_filters will play nice with :fq' do
36
+ solr_params = RSolr::Ext::Request.map(
37
+ :fq => 'blah blah',
38
+ :phrase_filters=>{:manu=>['Apple', 'ASG'], :color=>['red', 'blue']}
39
+ )
40
+ expected = {:fq=>["blah blah", "color:\"red\"", "color:\"blue\"", "manu:\"Apple\"", "manu:\"ASG\""]}
41
+
42
+ assert_equal 5, solr_params[:fq].size
43
+ assert solr_params[:fq].include?("blah blah")
44
+ assert solr_params[:fq].include?("color:\"red\"")
45
+ assert solr_params[:fq].include?("color:\"blue\"")
46
+ assert solr_params[:fq].include?("manu:\"Apple\"")
47
+ assert solr_params[:fq].include?("manu:\"ASG\"")
28
48
  end
29
49
 
30
50
  end
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.11.1
4
+ version: 0.11.2
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-11-19 00:00:00 -05:00
12
+ date: 2010-01-07 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency