sunspot 1.0.3 → 1.0.4

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.
@@ -1,3 +1,9 @@
1
+ == 1.0.4 2010-03-19
2
+ * Update solr-spatial-light to 0.0.5
3
+ * Fix NullPointerException in repeated geo search
4
+ * Fix missing distances in repeated geo search
5
+ * Don't query the data store more than once when results are missing
6
+
1
7
  == 1.0.2 2010-03-11
2
8
  * Restore Hit#distance for result geo distance
3
9
  * Remove :distance special sort
@@ -13,6 +13,9 @@ objects such as the filesystem.
13
13
 
14
14
  === Where to learn all about Sunspot: The Wiki!
15
15
 
16
+ New to Sunspot and using Rails? Check out {Adding Sunspot search to Rails in 5
17
+ minutes or less}[http://wiki.github.com/outoftime/sunspot/adding-sunspot-search-to-rails-in-5-minutes-or-less].
18
+
16
19
  This README is intended as a quick primer on what Sunspot is capable of; for
17
20
  detailed treatment of Sunspot's full feature range, check out the wiki:
18
21
  http://wiki.github.com/outoftime/sunspot
@@ -207,6 +210,7 @@ Sunspot repository at `upstream`:
207
210
  * {Sunspot: A Solr-Powered Search Engine for Ruby}[http://www.linux-mag.com/id/7341] (Linux Magazine)
208
211
  * {Using Sunspot for Free-Text Search with Redis}[http://masonoise.wordpress.com/2010/02/06/using-sunspot-for-free-text-search-with-redis/] (While I Pondered...)
209
212
  * {Default scope with Sunspot}[http://www.cloudspace.com/blog/2010/01/15/default-scope-with-sunspot/] (Cloudspace)
213
+ * {Chef recipe for Sunspot in production}[http://gist.github.com/336403]
210
214
  * {Testing Sunspot with Cucumber}[http://blog.trydionel.com/2010/02/06/testing-sunspot-with-cucumber/] (spiral_code)
211
215
  * {Running cucumber features with sunspot_rails}[http://blog.kabisa.nl/2010/02/03/running-cucumber-features-with-sunspot_rails] (Kabisa Blog)
212
216
  * {How To Use Twitter Lists to Determine Influence}[http://www.untitledstartup.com/2010/01/how-to-use-twitter-lists-to-determine-influence/] (Untitled Startup)
@@ -213,10 +213,13 @@ module Sunspot
213
213
  end
214
214
  id_hit_hash.each_pair do |class_name, hits|
215
215
  ids = hits.map { |id, hit| hit.primary_key }
216
- data_accessor_for(Util.full_const_get(class_name)).load_all(ids).each do |result|
217
- hit = id_hit_hash[class_name][Adapters::InstanceAdapter.adapt(result).id.to_s]
216
+ data_accessor = data_accessor_for(Util.full_const_get(class_name))
217
+ hits_for_class = id_hit_hash[class_name]
218
+ data_accessor.load_all(ids).each do |result|
219
+ hit = hits_for_class.delete(Adapters::InstanceAdapter.adapt(result).id.to_s)
218
220
  hit.result = result
219
221
  end
222
+ hits_for_class.values.each { |hit| hit.result = nil }
220
223
  end
221
224
  end
222
225
 
@@ -91,9 +91,8 @@ module Sunspot
91
91
  # load their instances using the adapter's #load_all method.
92
92
  #
93
93
  def result
94
- if @result.nil?
95
- @search.populate_hits
96
- end
94
+ return @result if defined?(@result)
95
+ @search.populate_hits
97
96
  @result
98
97
  end
99
98
  alias_method :instance, :result
@@ -1,3 +1,3 @@
1
1
  module Sunspot
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -56,4 +56,14 @@ describe 'search results', :type => :search do
56
56
  stub_results(*posts)
57
57
  session.search(Post).results.should == posts[0..0]
58
58
  end
59
+
60
+ it 'does not attempt to query the data store more than once when results are unavailable' do
61
+ posts = [Post.new, Post.new]
62
+ posts.each { |post| post.destroy }
63
+ stub_results(*posts)
64
+ search = session.search(Post) do
65
+ data_accessor_for(Post).should_receive(:load_all).once.and_return([])
66
+ end
67
+ search.results.should == []
68
+ end
59
69
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mat Brown
@@ -24,7 +24,7 @@ autorequire:
24
24
  bindir: bin
25
25
  cert_chain: []
26
26
 
27
- date: 2010-03-11 00:00:00 -05:00
27
+ date: 2010-03-19 00:00:00 -04:00
28
28
  default_executable:
29
29
  dependencies:
30
30
  - !ruby/object:Gem::Dependency
@@ -246,7 +246,7 @@ files:
246
246
  - solr/solr/conf/scripts.conf
247
247
  - solr/solr/conf/schema.xml
248
248
  - solr/solr/conf/stopwords.txt
249
- - solr/solr/lib/solr-spatial-light-0.0.4.jar
249
+ - solr/solr/lib/solr-spatial-light-0.0.5.jar
250
250
  - solr/solr/lib/lucene-spatial-2.9.1.jar
251
251
  - solr/start.jar
252
252
  has_rdoc: true