solrsan 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -110,6 +110,10 @@ A simple search query:
110
110
  More searching examples can be seen in test/unit/search_test.rb
111
111
 
112
112
  ## Changelog
113
+ 0.5.6
114
+ Tests use sleep since test index are using commitWithin. Fixed rsolr
115
+ reference.
116
+
113
117
  0.5.5
114
118
  Fixed usage of commitWithin.
115
119
 
@@ -53,7 +53,8 @@ module Solrsan
53
53
  raise "Indexed document must define a as_solr_document method."
54
54
  end
55
55
 
56
- rsolr.add(solr_docs, opts)
56
+ @rsolr ||= Solrsan::Config.instance.rsolr_object
57
+ @rsolr.add(solr_docs, opts)
57
58
  end
58
59
 
59
60
  def index_all
@@ -11,7 +11,7 @@ module Solrsan
11
11
  end
12
12
 
13
13
  def perform_solr_command
14
- @rsolr = Solrsan::Config.instance.rsolr_object
14
+ @rsolr ||= Solrsan::Config.instance.rsolr_object
15
15
  yield(@rsolr)
16
16
  @rsolr.commit
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Solrsan
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
data/solrsan.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Lightweight wrapper for using Apache Solr within a Ruby application including Rails and Sinatra.}
13
13
  s.description = %q{solrsan is a lightweight wrapper for using Apache Solr within a Ruby application including Rails and Sinatra.}
14
14
 
15
- s.add_dependency('rsolr', '~>1.0.4')
15
+ s.add_dependency('rsolr', '~>1.0.6')
16
16
  s.add_dependency('activemodel', '~>3.1.1')
17
17
  s.add_dependency('activesupport', '~>3.1.1')
18
18
 
@@ -15,6 +15,7 @@ class SearchTest < Test::Unit::TestCase
15
15
 
16
16
  def test_simple_query
17
17
  Document.solr_index(@document)
18
+ sleep 1
18
19
  q = @document.attributes[:title]
19
20
 
20
21
  response = Document.search(:q => q)
@@ -26,6 +27,7 @@ class SearchTest < Test::Unit::TestCase
26
27
  def test_sort
27
28
  Document.solr_index(Document.new(:id => 3, :title => "solar city",:review_count => 10))
28
29
  Document.solr_index(Document.new(:id => 4, :title => "city solar", :review_count => 5))
30
+ sleep 1
29
31
 
30
32
  q = "solar"
31
33
  response = Document.search(:q => q, :sort => "review_count asc")
@@ -127,7 +129,8 @@ class SearchTest < Test::Unit::TestCase
127
129
  def test_filter_query_mulitple_filters
128
130
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10, :tags => ['ruby']))
129
131
  Document.solr_index(Document.new(:id => 4, :author => "Ernie", :title => "lucene solr", :review_count => 5, :tags => ['ruby', 'scala']))
130
-
132
+ sleep 1
133
+
131
134
  response = Document.search(:q => "solr", :fq => {:tags => ["scala"], :author => "Ernie"})
132
135
  docs = response[:docs]
133
136
  metadata = response[:metadata]
@@ -142,6 +145,7 @@ class SearchTest < Test::Unit::TestCase
142
145
  def test_filter_query
143
146
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10, :tags => ['ruby']))
144
147
  Document.solr_index(Document.new(:id => 4, :author => "Ernie", :title => "lucene solr", :review_count => 5, :tags => ['ruby', 'scala']))
148
+ sleep 1
145
149
 
146
150
  response = Document.search(:q => "solr", :fq => [{:tags => ["scala"]}])
147
151
  docs = response[:docs]
@@ -157,6 +161,7 @@ class SearchTest < Test::Unit::TestCase
157
161
  def test_text_faceting
158
162
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10))
159
163
  Document.solr_index(Document.new(:id => 4, :author => "Ernie", :title => "lucene solr", :review_count => 5))
164
+ sleep 1
160
165
 
161
166
  response = Document.search(:q => "solr", :'facet.field' => ['author'])
162
167
  docs = response[:docs]
@@ -170,7 +175,8 @@ class SearchTest < Test::Unit::TestCase
170
175
  def test_range_faceting
171
176
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10))
172
177
  Document.solr_index(Document.new(:id => 4, :author => "Ernie", :title => "lucene solr", :review_count => 5))
173
-
178
+ sleep 1
179
+
174
180
  response = Document.search(:q => "solr", :'facet.field' => ['author'], :'facet.query' => ["review_count:[1 TO 5]", "review_count:[6 TO 10]"])
175
181
  docs = response[:docs]
176
182
  facet_counts = response[:facet_counts]
@@ -182,6 +188,7 @@ class SearchTest < Test::Unit::TestCase
182
188
 
183
189
  def test_highlighting_support
184
190
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10, :tags => ["solr"]))
191
+ sleep 1
185
192
 
186
193
  response = Document.search(:q => "solr",
187
194
  :'hl.fl' => "*")
@@ -189,20 +196,24 @@ class SearchTest < Test::Unit::TestCase
189
196
  highlighting = response[:highlighting]
190
197
 
191
198
  first_result = highlighting.first
199
+ assert_not_nil first_result
192
200
  assert first_result[1]['tags'].include?("<mark>solr</mark>")
193
201
  end
194
202
 
195
203
  def test_embed_highlighting
196
204
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10, :tags => ["solr", "sphinx"]))
205
+ sleep 1
197
206
 
198
207
  response = Document.search(:q => "solr",
199
208
  :'hl.fl' => "*")
200
209
  docs = response[:docs]
210
+ assert_not_nil docs.first
201
211
  assert_equal ["<mark>solr</mark>","sphinx"], docs.first['tags']
202
212
  end
203
213
 
204
214
  def test_debug_response
205
215
  Document.solr_index(@document)
216
+ sleep 1
206
217
  q = @document.attributes[:title]
207
218
 
208
219
  response = Document.search({:q => q, :debugQuery => true})
@@ -212,16 +223,19 @@ class SearchTest < Test::Unit::TestCase
212
223
 
213
224
  def test_stats_response
214
225
  Document.solr_index(@document)
226
+ sleep 1
215
227
  q = @document.attributes[:title]
216
228
 
217
229
  response = Document.search({:q => q, :stats => true, :'stats.field' => 'review_count'})
218
230
  assert_not_nil response[:stats]
231
+ assert_not_nil response[:stats]['stats_fields']['review_count']
219
232
  assert_equal 1, response[:stats]['stats_fields']['review_count']['count']
220
233
  end
221
234
 
222
235
  def test_will_paginate_support
223
236
  Document.solr_index(Document.new(:id => 3, :author => "Bert", :title => "solr lucene",:review_count => 10))
224
237
  Document.solr_index(Document.new(:id => 4, :author => "Ernie", :title => "lucene solr", :review_count => 5))
238
+ sleep 1
225
239
 
226
240
  response = Document.search(:q => "solr")
227
241
  docs = response[:docs]
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.5.5
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,18 +13,18 @@ date: 2012-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rsolr
16
- requirement: &70164952503540 !ruby/object:Gem::Requirement
16
+ requirement: &70205242302760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.4
21
+ version: 1.0.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70164952503540
24
+ version_requirements: *70205242302760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activemodel
27
- requirement: &70164952502840 !ruby/object:Gem::Requirement
27
+ requirement: &70205242302160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70164952502840
35
+ version_requirements: *70205242302160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &70164952502260 !ruby/object:Gem::Requirement
38
+ requirement: &70205242301660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 3.1.1
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70164952502260
46
+ version_requirements: *70205242301660
47
47
  description: solrsan is a lightweight wrapper for using Apache Solr within a Ruby
48
48
  application including Rails and Sinatra.
49
49
  email: