solrsan 0.0.27 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,11 +56,13 @@ module Solrsan
56
56
  :start => solr_response['response']['start'],
57
57
  :rows => solr_response['responseHeader']['params']['rows'],
58
58
  :time => solr_response['responseHeader']['QTime'],
59
- :status => solr_response['responseHeader']['status']
59
+ :status => solr_response['responseHeader']['status'],
60
+ :debug => solr_response['debug']
60
61
  }
61
62
 
62
63
  response = {:docs => docs, :metadata => metadata,
63
64
  :facet_counts => parsed_facet_counts, :highlighting => highlighting}
65
+ response[:stats] = solr_response['stats'] if solr_response['stats']
64
66
 
65
67
  embed_highlighting(response)
66
68
  end
@@ -1,3 +1,3 @@
1
1
  module Solrsan
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
@@ -174,7 +174,26 @@ class SearchTest < Test::Unit::TestCase
174
174
  response = Document.search(:q => "solr",
175
175
  :'hl.fl' => "*")
176
176
  docs = response[:docs]
177
- assert_equal ["sphinx", "<mark>solr</mark>"], docs.first['tags']
177
+ assert_equal ["<mark>solr</mark>","sphinx"], docs.first['tags']
178
178
  end
179
+
180
+ def test_debug_response
181
+ Document.index(@document)
182
+ q = @document.attributes[:title]
183
+
184
+ response = Document.search({:q => q, :debugQuery => true})
185
+ metadata = response[:metadata]
186
+ assert_not_nil metadata[:debug]
187
+ end
188
+
189
+ def test_stats_response
190
+ Document.index(@document)
191
+ q = @document.attributes[:title]
192
+
193
+ response = Document.search({:q => q, :stats => true, :'stats.field' => 'review_count'})
194
+ assert_not_nil response[:stats]
195
+ assert_equal 1, response[:stats]['stats_fields']['review_count']['count']
196
+ end
197
+
179
198
  end
180
199
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrsan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-03-25 00:00:00.000000000 -07:00
12
+ date: 2011-04-03 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
17
- requirement: &2153251880 !ruby/object:Gem::Requirement
17
+ requirement: &2151817140 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2153251880
25
+ version_requirements: *2151817140
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activemodel
28
- requirement: &2153251380 !ruby/object:Gem::Requirement
28
+ requirement: &2151814540 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.5
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2153251380
36
+ version_requirements: *2151814540
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: activesupport
39
- requirement: &2153250920 !ruby/object:Gem::Requirement
39
+ requirement: &2151813460 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 3.0.5
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2153250920
47
+ version_requirements: *2151813460
48
48
  description: solrsan is a lightweight wrapper for using Apache Solr within a Ruby
49
49
  application including Rails and Sinatra.
50
50
  email: