supernova 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest CHANGED
@@ -6,4 +6,5 @@ Autotest.add_hook :initialize do |at|
6
6
  at.add_exception(%r{log\/})
7
7
  at.add_exception(%r{db\/})
8
8
  at.add_exception(%r{config\/})
9
+ at.add_exception(%r{solr\/})
9
10
  end
data/Gemfile CHANGED
@@ -7,6 +7,8 @@ source "http://rubygems.org"
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
 
9
9
  gem "thinking-sphinx", "2.0.3"
10
+ gem "rsolr"
11
+ gem "will_paginate"
10
12
 
11
13
  group :development do
12
14
  gem "ruby-debug"
@@ -31,6 +31,8 @@ GEM
31
31
  rake (0.9.2)
32
32
  rcov (0.9.9)
33
33
  riddle (1.3.3)
34
+ rsolr (1.0.2)
35
+ builder (>= 2.1.2)
34
36
  rspec (2.3.0)
35
37
  rspec-core (~> 2.3.0)
36
38
  rspec-expectations (~> 2.3.0)
@@ -48,6 +50,7 @@ GEM
48
50
  activerecord (>= 3.0.3)
49
51
  riddle (>= 1.2.2)
50
52
  tzinfo (0.3.27)
53
+ will_paginate (2.3.15)
51
54
 
52
55
  PLATFORMS
53
56
  ruby
@@ -60,6 +63,8 @@ DEPENDENCIES
60
63
  jeweler (~> 1.6.0)
61
64
  mysql2 (~> 0.2.7)
62
65
  rcov
66
+ rsolr
63
67
  rspec (~> 2.3.0)
64
68
  ruby-debug
65
69
  thinking-sphinx (= 2.0.3)
70
+ will_paginate
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
17
  gem.name = "supernova"
18
- # gem.homepage = "http://github.com/dynport/supernova"
18
+ gem.homepage = "http://github.com/dynport/supernova"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{Unified search scopes}
21
21
  gem.description = %Q{Unified search scopes}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -1,4 +1,11 @@
1
+ require "rsolr"
2
+
1
3
  module Supernova
4
+ KM_TO_METER = 1000.0
5
+ MILE_TO_METER = 1609.3472
6
+ DEG_TO_RADIAN = Math::PI / 180.0
7
+ RADIAN_TO_REG = 1 / DEG_TO_RADIAN
8
+
2
9
  module ClassMethods
3
10
  attr_accessor :criteria_class, :defined_named_search_scopes
4
11
 
@@ -17,5 +24,7 @@ module Supernova
17
24
  end
18
25
 
19
26
  require "supernova/numeric_extensions"
27
+ require "supernova/collection"
20
28
  require "supernova/criteria"
21
- require "supernova/thinking_sphinx"
29
+ require "supernova/thinking_sphinx"
30
+ require "supernova/solr"
@@ -0,0 +1,4 @@
1
+ require "will_paginate"
2
+
3
+ class Supernova::Collection < WillPaginate::Collection
4
+ end
@@ -1,4 +1,7 @@
1
1
  class Supernova::Criteria
2
+ DEFAULT_PER_PAGE = 25
3
+ FIRST_PAGE = 1
4
+
2
5
  attr_accessor :filters, :search_options, :clazz
3
6
 
4
7
  class << self
@@ -111,6 +114,18 @@ class Supernova::Criteria
111
114
  def to_a
112
115
  implement_in_subclass
113
116
  end
117
+
118
+ def current_page
119
+ pagination_attribute_when_greater_zero(:page) || 1
120
+ end
121
+
122
+ def per_page
123
+ pagination_attribute_when_greater_zero(:per_page) || DEFAULT_PER_PAGE
124
+ end
125
+
126
+ def pagination_attribute_when_greater_zero(attribute)
127
+ self.search_options[:pagination][attribute] if self.search_options[:pagination] && self.search_options[:pagination][attribute].to_i > 0
128
+ end
114
129
 
115
130
  def implement_in_subclass
116
131
  raise "implement in subclass"
@@ -1,11 +1,6 @@
1
1
  Numeric.class_eval do
2
- KM_TO_METER = 1000.0
3
- MILE_TO_METER = 1609.3472
4
- DEG_TO_RADIAN = Math::PI / 180.0
5
- RADIAN_TO_REG = 1 / DEG_TO_RADIAN
6
-
7
2
  def km
8
- self * KM_TO_METER
3
+ self * Supernova::KM_TO_METER
9
4
  end
10
5
 
11
6
  def meter
@@ -13,15 +8,15 @@ Numeric.class_eval do
13
8
  end
14
9
 
15
10
  def mile
16
- self * MILE_TO_METER
11
+ self * Supernova::MILE_TO_METER
17
12
  end
18
13
 
19
14
  def to_radians
20
- self * DEG_TO_RADIAN
15
+ self * Supernova::DEG_TO_RADIAN
21
16
  end
22
17
 
23
18
  def to_deg
24
- self * RADIAN_TO_REG
19
+ self * Supernova::RADIAN_TO_REG
25
20
  end
26
21
 
27
22
  alias_method :miles, :mile
@@ -0,0 +1,20 @@
1
+ require "supernova/solr_criteria"
2
+
3
+ module Supernova::Solr
4
+ class << self
5
+ attr_accessor :url
6
+
7
+ def connection
8
+ @connection ||= RSolr.connect(:url => self.url)
9
+ end
10
+
11
+ def truncate!
12
+ connection.delete_by_query("*:*")
13
+ end
14
+ end
15
+
16
+ def self.included(base)
17
+ base.extend(Supernova::ClassMethods)
18
+ base.criteria_class = Supernova::SolrCriteria
19
+ end
20
+ end
@@ -0,0 +1,51 @@
1
+ require "rsolr"
2
+
3
+ class Supernova::SolrCriteria < Supernova::Criteria
4
+ def to_params
5
+ solr_options = { :fq => [], :q => "*:*" }
6
+ solr_options[:fq] += self.filters[:with].map { |key, value| "#{key}:#{value}" } if self.filters[:with]
7
+ solr_options[:sort] = self.search_options[:order] if self.search_options[:order]
8
+ solr_options[:q] = self.filters[:search] if self.filters[:search]
9
+
10
+ if self.search_options[:geo_center] && self.search_options[:geo_distance]
11
+ solr_options[:pt] = "#{self.search_options[:geo_center][:lat]},#{self.search_options[:geo_center][:lng]}"
12
+ solr_options[:d] = self.search_options[:geo_distance].to_f / Supernova::KM_TO_METER
13
+ solr_options[:sfield] = :location
14
+ solr_options[:fq] << "{!geofilt}"
15
+ end
16
+ solr_options[:fq] << "type:#{self.clazz}" if self.clazz
17
+
18
+ if self.search_options[:pagination]
19
+ solr_options[:rows] = per_page
20
+ solr_options[:start] = (current_page - 1) * solr_options[:rows]
21
+ end
22
+ solr_options
23
+ end
24
+
25
+ def build_docs(docs)
26
+ docs.map do |hash|
27
+ build_doc(hash)
28
+ end
29
+ end
30
+
31
+ def build_doc(hash)
32
+ doc = hash["type"].constantize.new
33
+ hash.each do |key, value|
34
+ if key == "id"
35
+ doc.id = value.to_s.split("/").last if doc.respond_to?(:id=)
36
+ else
37
+ doc.send(:"#{key}=", value) if doc.respond_to?(:"#{key}=")
38
+ end
39
+ end
40
+ doc.instance_variable_set("@readonly", true)
41
+ doc.instance_variable_set("@new_record", false)
42
+ doc
43
+ end
44
+
45
+ def to_a
46
+ response = Supernova::Solr.connection.get("select", :params => to_params)
47
+ collection = Supernova::Collection.new(current_page, per_page, response["response"]["numFound"])
48
+ collection.replace(build_docs(response["response"]["docs"]))
49
+ collection
50
+ end
51
+ end
@@ -0,0 +1,92 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Solr" do
4
+ before(:each) do
5
+ Supernova::Solr.instance_variable_set("@connection", nil)
6
+ Supernova::Solr.url = "http://localhost:8983/solr/"
7
+ Supernova::Solr.truncate!
8
+ Offer.criteria_class = Supernova::SolrCriteria
9
+ root = Geokit::LatLng.new(47, 11)
10
+ endpoint = root.endpoint(90, 50, :units => :kms)
11
+ Supernova::Solr.connection.add(:id => "offers/1", :type => "Offer", :user_id => 1, :enabled => false, :text => "Hans Meyer", :popularity => 10,
12
+ :location => "#{root.lat},#{root.lng}", :type => "Offer"
13
+ )
14
+ Supernova::Solr.connection.add(:id => "offers/2", :user_id => 2, :enabled => true, :text => "Marek Mintal", :popularity => 1,
15
+ :location => "#{endpoint.lat},#{endpoint.lng}", :type => "Offer"
16
+ )
17
+ Supernova::Solr.connection.commit
18
+ end
19
+
20
+ after(:each) do
21
+ Supernova::Solr.url = nil
22
+ Supernova::Solr.instance_variable_set("@connection", nil)
23
+ Offer.criteria_class = Supernova::ThinkingSphinxCriteria
24
+ end
25
+
26
+ def new_criteria
27
+ Offer.search_scope
28
+ end
29
+
30
+ describe "searching" do
31
+ it "returns the correct current_page when nil" do
32
+ new_criteria.to_a.current_page.should == 1
33
+ end
34
+
35
+ it "returns the correct page when set" do
36
+ new_criteria.paginate(:page => 10).to_a.current_page.should == 10
37
+ end
38
+
39
+ it "the correct per_page when set" do
40
+ new_criteria.paginate(:per_page => 10).to_a.per_page.should == 10
41
+ end
42
+
43
+ it "the correct per_page when not set" do
44
+ new_criteria.to_a.per_page.should == 25
45
+ end
46
+
47
+ describe "nearby search" do
48
+ { 49.kms => 1, 51.kms => 2 }.each do |distance, total_entries|
49
+ it "returns #{total_entries} for distance #{distance}" do
50
+ new_criteria.near(47, 11).within(distance).to_a.total_entries.should == total_entries
51
+ end
52
+ end
53
+ end
54
+
55
+ it "returns the correct objects" do
56
+ new_criteria.with(:user_id => 1).to_a.first.should be_an_instance_of(Offer)
57
+ end
58
+
59
+ { :id => 1, :user_id => 1, :enabled => false, :text => "Hans Meyer", :popularity => 10 }.each do |key, value|
60
+ it "sets #{key} to #{value}" do
61
+ doc = new_criteria.with(:id => "offers/1").to_a.first
62
+ doc.send(key).should == value
63
+ end
64
+ end
65
+
66
+ it "combines filters" do
67
+ new_criteria.with(:user_id => 1, :enabled => false).to_a.total_entries.should == 1
68
+ new_criteria.with(:user_id => 1, :enabled => true).to_a.total_entries.should == 0
69
+ end
70
+
71
+ it "uses the correct orders" do
72
+ new_criteria.order("id desc").to_a.map(&:id).should == [2, 1]
73
+ new_criteria.order("id asc").to_a.map(&:id).should == [1, 2]
74
+ end
75
+
76
+ it "uses the correct pagination attributes" do
77
+ new_criteria.with(:user_id => 1, :enabled => false).to_a.total_entries.should == 1
78
+ new_criteria.with(:user_id => 1, :enabled => false).length.should == 1
79
+ new_criteria.with(:user_id => 1, :enabled => false).paginate(:page => 10).to_a.total_entries.should == 1
80
+ new_criteria.with(:user_id => 1, :enabled => false).paginate(:page => 10).length.should == 0
81
+
82
+ new_criteria.paginate(:per_page => 1, :page => 1).to_a.map(&:id).should == [1]
83
+ new_criteria.paginate(:per_page => 1, :page => 2).to_a.map(&:id).should == [2]
84
+ end
85
+
86
+ it "handels empty results correctly" do
87
+ results = new_criteria.with(:user_id => 1, :enabled => true).to_a
88
+ results.total_entries.should == 0
89
+ results.current_page.should == 1
90
+ end
91
+ end
92
+ end
@@ -3,9 +3,8 @@ require "active_record"
3
3
  require "thinking_sphinx"
4
4
  require "mysql2"
5
5
  require "fileutils"
6
- require "geokit"
7
6
 
8
- describe "Search" do
7
+ describe "ThinkingSphinx" do
9
8
  let(:ts) { ThinkingSphinx::Configuration.instance }
10
9
 
11
10
  before(:each) do
@@ -6,6 +6,7 @@ require "mysql2"
6
6
  require "logger"
7
7
  require "fileutils"
8
8
  require "ruby-debug"
9
+ require "geokit"
9
10
 
10
11
  if defined?(Debugger) && Debugger.respond_to?(:settings)
11
12
  Debugger.settings[:autolist] = 1
@@ -62,4 +63,5 @@ class Offer < ActiveRecord::Base
62
63
  end
63
64
 
64
65
  class Host
66
+ attr_accessor :id
65
67
  end
@@ -0,0 +1,245 @@
1
+ require 'spec_helper'
2
+
3
+ describe Supernova::SolrCriteria do
4
+ let(:criteria) { Supernova::SolrCriteria.new }
5
+ let(:rsolr) { double("rsolr").as_null_object }
6
+ let(:docs) do
7
+ [
8
+ {"popularity"=>10, "location"=>"47,11", "text"=>"Hans Meyer", "id"=>"offers/1", "enabled"=>false, "user_id"=>1, "type"=>"Offer"},
9
+ {"popularity"=>1, "location"=>"46.9981112912042,11.6587158814378", "text"=>"Marek Mintal", "id"=>"offers/2", "enabled"=>true, "user_id"=>2, "type"=>"Offer"}
10
+ ]
11
+ end
12
+ let(:solr_response) do
13
+ {
14
+ "response"=>{"start"=>0, "docs"=>docs, "numFound"=>2}, "responseHeader"=>{"QTime"=>4, "params"=>{"fq"=>"type:Offer", "q"=>"*:*", "wt"=>"ruby"}, "status"=>0}
15
+ }
16
+ end
17
+
18
+ before(:each) do
19
+ Supernova::Solr.stub!(:connection).and_return rsolr
20
+ end
21
+
22
+ describe "#to_params" do
23
+ it "returns a Hash" do
24
+ criteria.to_params.should be_an_instance_of(Hash)
25
+ end
26
+
27
+ it "sets the correct filters" do
28
+ criteria.with(:title => "Hans Maulwurf", :playings => 10).to_params[:fq].sort.should == ["playings:10", "title:Hans Maulwurf"]
29
+ end
30
+
31
+ it "allways includes some query" do
32
+ criteria.with(:a => 1).to_params[:q].should == "*:*"
33
+ end
34
+
35
+ it "sets the order field" do
36
+ criteria.order("title").to_params[:sort].should == "title"
37
+ end
38
+
39
+ it "sets search correct search query" do
40
+ criteria.search("some query").to_params[:q].should == "some query"
41
+ end
42
+
43
+ it "adds a filter on type when clazz set" do
44
+ Supernova::SolrCriteria.new(Offer).to_params[:fq].should == ["type:#{Offer}"]
45
+ end
46
+
47
+ it "does not add a filter on type when clazz is nil" do
48
+ criteria.to_params[:fq].should == []
49
+ end
50
+
51
+ describe "with a nearby search" do
52
+ let(:nearby_criteria) { Supernova::SolrCriteria.new.near(47, 11).within(10.kms) }
53
+
54
+ it "sets the correct center" do
55
+ nearby_criteria.to_params[:pt].should == "47.0,11.0"
56
+ end
57
+
58
+ it "sets the correct distance" do
59
+ nearby_criteria.to_params[:d].should == 10.0
60
+ end
61
+
62
+ it "sets the sfield to location" do
63
+ nearby_criteria.to_params[:sfield].should == :location
64
+ end
65
+
66
+ it "sets the fq field to {!geofilt}" do
67
+ nearby_criteria.to_params[:fq].should == ["{!geofilt}"]
68
+ end
69
+ end
70
+
71
+ describe "pagination" do
72
+ it "sets the correct rows" do
73
+ criteria.paginate(:page => 1, :per_page => 10).to_params[:rows].should == 10
74
+ end
75
+
76
+ it "sets the correct start when page is nil" do
77
+ criteria.paginate(:per_page => 10).to_params[:start].should == 0
78
+ end
79
+
80
+ it "sets the correct start when page is 1" do
81
+ criteria.paginate(:per_page => 10, :page => 1).to_params[:start].should == 0
82
+ end
83
+
84
+ it "sets the correct start when page is 1" do
85
+ criteria.paginate(:per_page => 10, :page => 2).to_params[:start].should == 10
86
+ end
87
+ end
88
+ end
89
+
90
+ describe "#to_a" do
91
+ let(:params) { double("params") }
92
+
93
+ before(:each) do
94
+ criteria.stub(:to_params).and_return params
95
+ rsolr.stub!(:get).and_return solr_response
96
+ end
97
+
98
+ it "calls to_params" do
99
+ criteria.should_receive(:to_params).and_return params
100
+ criteria.to_a
101
+ end
102
+
103
+ it "calls get with select and params" do
104
+ rsolr.should_receive(:get).with("select", :params => params).and_return solr_response
105
+ criteria.to_a
106
+ end
107
+
108
+ it "returns a Supernova::Collection" do
109
+ criteria.to_a.should be_an_instance_of(Supernova::Collection)
110
+ end
111
+
112
+ it "sets the correct page when page is nil" do
113
+ criteria.to_a.current_page.should == 1
114
+ end
115
+
116
+ it "sets the correct page when page is 1" do
117
+ criteria.paginate(:page => 1).to_a.current_page.should == 1
118
+ end
119
+
120
+ it "sets the correct page when page is 2" do
121
+ criteria.paginate(:page => 2).to_a.current_page.should == 2
122
+ end
123
+
124
+ it "sets the correct per_page when zero" do
125
+ criteria.paginate(:page => 2, :per_page => nil).to_a.per_page.should == 25
126
+ end
127
+
128
+ it "sets the custom per_page when given" do
129
+ criteria.paginate(:page => 2, :per_page => 10).to_a.per_page.should == 10
130
+ end
131
+
132
+ it "sets the correct total_entries" do
133
+ criteria.paginate(:page => 2, :per_page => 10).to_a.total_entries.should == 2
134
+ end
135
+
136
+ it "calls build_docs with returned docs" do
137
+ criteria.should_receive(:build_docs).with(docs).and_return []
138
+ criteria.to_a
139
+ end
140
+
141
+ it "calls replace on collection wit returned docs" do
142
+ col = double("collection")
143
+ Supernova::Collection.stub!(:new).and_return col
144
+ built_docs = double("built docs")
145
+ criteria.stub!(:build_docs).and_return built_docs
146
+ col.should_receive(:replace).with(built_docs)
147
+ criteria.to_a
148
+ end
149
+ end
150
+
151
+ describe "#build_docs" do
152
+ it "returns an array" do
153
+ criteria.build_docs([]).should == []
154
+ end
155
+
156
+ it "returns the correct amount of docs" do
157
+ criteria.build_docs(docs).length.should == 2
158
+ end
159
+
160
+ it "returns the correct classes" do
161
+ docs = [ { "id" => "hosts/7", "type" => "Host" }, { "id" => "offers/1", "type" => "Offer" }]
162
+ criteria.build_docs(docs).map(&:class).should == [Host, Offer]
163
+ end
164
+
165
+ it "calls build_doc on all returnd docs" do
166
+ doc1 = double("doc1")
167
+ doc2 = double("doc2")
168
+ docs = [doc1, doc2]
169
+ criteria.should_receive(:build_doc).with(doc1)
170
+ criteria.should_receive(:build_doc).with(doc2)
171
+ criteria.build_docs(docs)
172
+ end
173
+ end
174
+
175
+ describe "#build_doc" do
176
+ { "Offer" => Offer, "Host" => Host }.each do |type, clazz|
177
+ it "returns the #{clazz} for #{type.inspect}" do
178
+ criteria.build_doc("type" => type).should be_an_instance_of(clazz)
179
+ end
180
+ end
181
+
182
+ { :popularity => 10, :enabled => false, :id => 1 }.each do |key, value|
183
+ it "sets #{key} to #{value}" do
184
+ doc = criteria.build_doc("type" => "Offer", "some_other" => "Test", "id" => "offers/1", "enabled" => false, "popularity" => 10)
185
+ doc.send(key).should == value
186
+ end
187
+ end
188
+
189
+ it "should be readonly" do
190
+ criteria.build_doc(docs.first).should be_readonly
191
+ end
192
+
193
+ it "should not be a new record" do
194
+ criteria.build_doc(docs.first).should_not be_a_new_record
195
+ end
196
+
197
+ class MongoOffer
198
+ attr_accessor :id
199
+ end
200
+
201
+ it "would also work with mongoid ids" do
202
+ criteria.build_doc("type" => "MongoOffer", "id" => "offers/4df08c30f3b0a72e7c227a55").id.should == "4df08c30f3b0a72e7c227a55"
203
+ end
204
+ end
205
+
206
+ describe "#current_page" do
207
+ it "returns 1 when pagiantion is not set" do
208
+ criteria.current_page.should == 1
209
+ end
210
+
211
+ it "returns 1 when page is set to nil" do
212
+ criteria.paginate(:page => nil).current_page.should == 1
213
+ end
214
+
215
+ it "returns 1 when page is set to nil" do
216
+ criteria.paginate(:page => 1).current_page.should == 1
217
+ end
218
+
219
+ it "returns 1 when page is set to nil" do
220
+ criteria.paginate(:page => 0).current_page.should == 1
221
+ end
222
+
223
+ it "returns 2 when page is set to 2" do
224
+ criteria.paginate(:page => 2).current_page.should == 2
225
+ end
226
+ end
227
+
228
+ describe "#per_page" do
229
+ it "returns 25 when nothing set" do
230
+ criteria.per_page.should == 25
231
+ end
232
+
233
+ it "returns 25 when set to nil" do
234
+ criteria.paginate(:page => 3, :per_page => nil).per_page.should == 25
235
+ end
236
+
237
+ it "returns 25 when set to 0" do
238
+ criteria.paginate(:page => 3, :per_page => 0).per_page.should == 25
239
+ end
240
+
241
+ it "returns the custom value when set" do
242
+ criteria.paginate(:page => 3, :per_page => 10).per_page.should == 10
243
+ end
244
+ end
245
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Supernova::Solr do
4
+ let(:rsolr) { double("rsolr") }
5
+
6
+ before(:each) do
7
+ RSolr.stub!(:connect).and_return rsolr
8
+ end
9
+
10
+ describe "#url=" do
11
+ it "allows setting a solr url" do
12
+ Supernova::Solr.url = "some url"
13
+ Supernova::Solr.url.should == "some url"
14
+ end
15
+ end
16
+
17
+ describe "#solr_connection" do
18
+ after(:each) do
19
+ Supernova::Solr.url = nil
20
+ end
21
+
22
+ before(:each) do
23
+ Supernova::Solr.url = "/some/url"
24
+ end
25
+
26
+ it "connects creates and stores a new RSolr connection" do
27
+ RSolr.should_receive(:connect).with(:url => "/some/url").and_return rsolr
28
+ Supernova::Solr.connection.should == rsolr
29
+ Supernova::Solr.instance_variable_get("@connection").should == rsolr
30
+ end
31
+
32
+ it "returns a stored connection" do
33
+ con = double("con")
34
+ Supernova::Solr.instance_variable_set("@connection", con)
35
+ Supernova::Solr.connection.should == con
36
+ end
37
+ end
38
+
39
+ describe "truncate!" do
40
+ it "calls delete_by_query on connection" do
41
+ Supernova::Solr.connection.should_receive(:delete_by_query).with("*:*")
42
+ Supernova::Solr.truncate!
43
+ end
44
+ end
45
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{supernova}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tobias Schwab"]
12
- s.date = %q{2011-06-08}
12
+ s.date = %q{2011-06-09}
13
13
  s.description = %q{Unified search scopes}
14
14
  s.email = %q{tobias.schwab@dynport.de}
15
15
  s.extra_rdoc_files = [
@@ -28,19 +28,26 @@ Gem::Specification.new do |s|
28
28
  "VERSION",
29
29
  "autotest/discover.rb",
30
30
  "lib/supernova.rb",
31
+ "lib/supernova/collection.rb",
31
32
  "lib/supernova/criteria.rb",
32
33
  "lib/supernova/numeric_extensions.rb",
34
+ "lib/supernova/solr.rb",
35
+ "lib/supernova/solr_criteria.rb",
33
36
  "lib/supernova/thinking_sphinx.rb",
34
37
  "lib/supernova/thinking_sphinx_criteria.rb",
35
38
  "spec/database.sql",
36
- "spec/integration/search_spec.rb",
39
+ "spec/integration/solr_spec.rb",
40
+ "spec/integration/thinking_sphinx_spec.rb",
37
41
  "spec/spec_helper.rb",
38
42
  "spec/supernova/criteria_spec.rb",
39
43
  "spec/supernova/numeric_extensions_spec.rb",
44
+ "spec/supernova/solr_criteria_spec.rb",
45
+ "spec/supernova/solr_spec.rb",
40
46
  "spec/supernova/thinking_sphinx_criteria_spec.rb",
41
47
  "spec/supernova_spec.rb",
42
48
  "supernova.gemspec"
43
49
  ]
50
+ s.homepage = %q{http://github.com/dynport/supernova}
44
51
  s.licenses = ["MIT"]
45
52
  s.require_paths = ["lib"]
46
53
  s.rubygems_version = %q{1.7.2}
@@ -51,6 +58,8 @@ Gem::Specification.new do |s|
51
58
 
52
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
60
  s.add_runtime_dependency(%q<thinking-sphinx>, ["= 2.0.3"])
61
+ s.add_runtime_dependency(%q<rsolr>, [">= 0"])
62
+ s.add_runtime_dependency(%q<will_paginate>, [">= 0"])
54
63
  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
55
64
  s.add_development_dependency(%q<mysql2>, ["~> 0.2.7"])
56
65
  s.add_development_dependency(%q<geokit>, [">= 0"])
@@ -62,6 +71,8 @@ Gem::Specification.new do |s|
62
71
  s.add_development_dependency(%q<rcov>, [">= 0"])
63
72
  else
64
73
  s.add_dependency(%q<thinking-sphinx>, ["= 2.0.3"])
74
+ s.add_dependency(%q<rsolr>, [">= 0"])
75
+ s.add_dependency(%q<will_paginate>, [">= 0"])
65
76
  s.add_dependency(%q<ruby-debug>, [">= 0"])
66
77
  s.add_dependency(%q<mysql2>, ["~> 0.2.7"])
67
78
  s.add_dependency(%q<geokit>, [">= 0"])
@@ -74,6 +85,8 @@ Gem::Specification.new do |s|
74
85
  end
75
86
  else
76
87
  s.add_dependency(%q<thinking-sphinx>, ["= 2.0.3"])
88
+ s.add_dependency(%q<rsolr>, [">= 0"])
89
+ s.add_dependency(%q<will_paginate>, [">= 0"])
77
90
  s.add_dependency(%q<ruby-debug>, [">= 0"])
78
91
  s.add_dependency(%q<mysql2>, ["~> 0.2.7"])
79
92
  s.add_dependency(%q<geokit>, [">= 0"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supernova
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Schwab
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-08 00:00:00 Z
18
+ date: 2011-06-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -44,11 +44,39 @@ dependencies:
44
44
  - 0
45
45
  version: "0"
46
46
  version_requirements: *id002
47
+ name: rsolr
48
+ prerelease: false
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ version_requirements: *id003
61
+ name: will_paginate
62
+ prerelease: false
63
+ type: :runtime
64
+ - !ruby/object:Gem::Dependency
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ version_requirements: *id004
47
75
  name: ruby-debug
48
76
  prerelease: false
49
77
  type: :development
50
78
  - !ruby/object:Gem::Dependency
51
- requirement: &id003 !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
52
80
  none: false
53
81
  requirements:
54
82
  - - ~>
@@ -59,12 +87,12 @@ dependencies:
59
87
  - 2
60
88
  - 7
61
89
  version: 0.2.7
62
- version_requirements: *id003
90
+ version_requirements: *id005
63
91
  name: mysql2
64
92
  prerelease: false
65
93
  type: :development
66
94
  - !ruby/object:Gem::Dependency
67
- requirement: &id004 !ruby/object:Gem::Requirement
95
+ requirement: &id006 !ruby/object:Gem::Requirement
68
96
  none: false
69
97
  requirements:
70
98
  - - ">="
@@ -73,12 +101,12 @@ dependencies:
73
101
  segments:
74
102
  - 0
75
103
  version: "0"
76
- version_requirements: *id004
104
+ version_requirements: *id006
77
105
  name: geokit
78
106
  prerelease: false
79
107
  type: :development
80
108
  - !ruby/object:Gem::Dependency
81
- requirement: &id005 !ruby/object:Gem::Requirement
109
+ requirement: &id007 !ruby/object:Gem::Requirement
82
110
  none: false
83
111
  requirements:
84
112
  - - ">="
@@ -87,12 +115,12 @@ dependencies:
87
115
  segments:
88
116
  - 0
89
117
  version: "0"
90
- version_requirements: *id005
118
+ version_requirements: *id007
91
119
  name: autotest
92
120
  prerelease: false
93
121
  type: :development
94
122
  - !ruby/object:Gem::Dependency
95
- requirement: &id006 !ruby/object:Gem::Requirement
123
+ requirement: &id008 !ruby/object:Gem::Requirement
96
124
  none: false
97
125
  requirements:
98
126
  - - ">="
@@ -101,12 +129,12 @@ dependencies:
101
129
  segments:
102
130
  - 0
103
131
  version: "0"
104
- version_requirements: *id006
132
+ version_requirements: *id008
105
133
  name: autotest-growl
106
134
  prerelease: false
107
135
  type: :development
108
136
  - !ruby/object:Gem::Dependency
109
- requirement: &id007 !ruby/object:Gem::Requirement
137
+ requirement: &id009 !ruby/object:Gem::Requirement
110
138
  none: false
111
139
  requirements:
112
140
  - - ~>
@@ -117,12 +145,12 @@ dependencies:
117
145
  - 3
118
146
  - 0
119
147
  version: 2.3.0
120
- version_requirements: *id007
148
+ version_requirements: *id009
121
149
  name: rspec
122
150
  prerelease: false
123
151
  type: :development
124
152
  - !ruby/object:Gem::Dependency
125
- requirement: &id008 !ruby/object:Gem::Requirement
153
+ requirement: &id010 !ruby/object:Gem::Requirement
126
154
  none: false
127
155
  requirements:
128
156
  - - ~>
@@ -133,12 +161,12 @@ dependencies:
133
161
  - 0
134
162
  - 0
135
163
  version: 1.0.0
136
- version_requirements: *id008
164
+ version_requirements: *id010
137
165
  name: bundler
138
166
  prerelease: false
139
167
  type: :development
140
168
  - !ruby/object:Gem::Dependency
141
- requirement: &id009 !ruby/object:Gem::Requirement
169
+ requirement: &id011 !ruby/object:Gem::Requirement
142
170
  none: false
143
171
  requirements:
144
172
  - - ~>
@@ -149,12 +177,12 @@ dependencies:
149
177
  - 6
150
178
  - 0
151
179
  version: 1.6.0
152
- version_requirements: *id009
180
+ version_requirements: *id011
153
181
  name: jeweler
154
182
  prerelease: false
155
183
  type: :development
156
184
  - !ruby/object:Gem::Dependency
157
- requirement: &id010 !ruby/object:Gem::Requirement
185
+ requirement: &id012 !ruby/object:Gem::Requirement
158
186
  none: false
159
187
  requirements:
160
188
  - - ">="
@@ -163,7 +191,7 @@ dependencies:
163
191
  segments:
164
192
  - 0
165
193
  version: "0"
166
- version_requirements: *id010
194
+ version_requirements: *id012
167
195
  name: rcov
168
196
  prerelease: false
169
197
  type: :development
@@ -188,19 +216,25 @@ files:
188
216
  - VERSION
189
217
  - autotest/discover.rb
190
218
  - lib/supernova.rb
219
+ - lib/supernova/collection.rb
191
220
  - lib/supernova/criteria.rb
192
221
  - lib/supernova/numeric_extensions.rb
222
+ - lib/supernova/solr.rb
223
+ - lib/supernova/solr_criteria.rb
193
224
  - lib/supernova/thinking_sphinx.rb
194
225
  - lib/supernova/thinking_sphinx_criteria.rb
195
226
  - spec/database.sql
196
- - spec/integration/search_spec.rb
227
+ - spec/integration/solr_spec.rb
228
+ - spec/integration/thinking_sphinx_spec.rb
197
229
  - spec/spec_helper.rb
198
230
  - spec/supernova/criteria_spec.rb
199
231
  - spec/supernova/numeric_extensions_spec.rb
232
+ - spec/supernova/solr_criteria_spec.rb
233
+ - spec/supernova/solr_spec.rb
200
234
  - spec/supernova/thinking_sphinx_criteria_spec.rb
201
235
  - spec/supernova_spec.rb
202
236
  - supernova.gemspec
203
- homepage:
237
+ homepage: http://github.com/dynport/supernova
204
238
  licenses:
205
239
  - MIT
206
240
  post_install_message: