moneypools-thinking-sphinx 1.2.11 → 1.2.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +4 -17
- data/VERSION.yml +1 -1
- data/features/a.rb +17 -0
- data/features/alternate_primary_key.feature +27 -0
- data/features/attribute_transformation.feature +22 -0
- data/features/attribute_updates.feature +33 -0
- data/features/datetime_deltas.feature +66 -0
- data/features/delayed_delta_indexing.feature +37 -0
- data/features/deleting_instances.feature +64 -0
- data/features/direct_attributes.feature +11 -0
- data/features/excerpts.feature +13 -0
- data/features/extensible_delta_indexing.feature +9 -0
- data/features/facets.feature +76 -0
- data/features/facets_across_model.feature +29 -0
- data/features/handling_edits.feature +92 -0
- data/features/retry_stale_indexes.feature +24 -0
- data/features/searching_across_models.feature +20 -0
- data/features/searching_by_model.feature +175 -0
- data/features/searching_with_find_arguments.feature +56 -0
- data/features/sphinx_detection.feature +25 -0
- data/features/sphinx_scopes.feature +35 -0
- data/features/step_definitions/alpha_steps.rb +3 -0
- data/features/step_definitions/beta_steps.rb +7 -0
- data/features/step_definitions/common_steps.rb +178 -0
- data/features/step_definitions/datetime_delta_steps.rb +15 -0
- data/features/step_definitions/delayed_delta_indexing_steps.rb +7 -0
- data/features/step_definitions/extensible_delta_indexing_steps.rb +7 -0
- data/features/step_definitions/facet_steps.rb +92 -0
- data/features/step_definitions/find_arguments_steps.rb +36 -0
- data/features/step_definitions/gamma_steps.rb +15 -0
- data/features/step_definitions/scope_steps.rb +11 -0
- data/features/step_definitions/search_steps.rb +89 -0
- data/features/step_definitions/sphinx_steps.rb +31 -0
- data/features/sti_searching.feature +14 -0
- data/features/support/db/active_record.rb +40 -0
- data/features/support/db/database.example.yml +3 -0
- data/features/support/db/fixtures/alphas.rb +10 -0
- data/features/support/db/fixtures/authors.rb +1 -0
- data/features/support/db/fixtures/betas.rb +10 -0
- data/features/support/db/fixtures/boxes.rb +9 -0
- data/features/support/db/fixtures/categories.rb +1 -0
- data/features/support/db/fixtures/cats.rb +3 -0
- data/features/support/db/fixtures/comments.rb +24 -0
- data/features/support/db/fixtures/delayed_betas.rb +10 -0
- data/features/support/db/fixtures/developers.rb +29 -0
- data/features/support/db/fixtures/dogs.rb +3 -0
- data/features/support/db/fixtures/extensible_betas.rb +10 -0
- data/features/support/db/fixtures/gammas.rb +10 -0
- data/features/support/db/fixtures/people.rb +1001 -0
- data/features/support/db/fixtures/posts.rb +6 -0
- data/features/support/db/fixtures/robots.rb +14 -0
- data/features/support/db/fixtures/tags.rb +27 -0
- data/features/support/db/fixtures/thetas.rb +10 -0
- data/features/support/db/migrations/create_alphas.rb +7 -0
- data/features/support/db/migrations/create_animals.rb +5 -0
- data/features/support/db/migrations/create_authors.rb +3 -0
- data/features/support/db/migrations/create_authors_posts.rb +6 -0
- data/features/support/db/migrations/create_betas.rb +5 -0
- data/features/support/db/migrations/create_boxes.rb +5 -0
- data/features/support/db/migrations/create_categories.rb +3 -0
- data/features/support/db/migrations/create_comments.rb +10 -0
- data/features/support/db/migrations/create_delayed_betas.rb +17 -0
- data/features/support/db/migrations/create_developers.rb +9 -0
- data/features/support/db/migrations/create_extensible_betas.rb +5 -0
- data/features/support/db/migrations/create_gammas.rb +3 -0
- data/features/support/db/migrations/create_people.rb +13 -0
- data/features/support/db/migrations/create_posts.rb +5 -0
- data/features/support/db/migrations/create_robots.rb +5 -0
- data/features/support/db/migrations/create_taggings.rb +5 -0
- data/features/support/db/migrations/create_tags.rb +4 -0
- data/features/support/db/migrations/create_thetas.rb +5 -0
- data/features/support/db/mysql.rb +3 -0
- data/features/support/db/postgresql.rb +3 -0
- data/features/support/env.rb +6 -0
- data/features/support/lib/generic_delta_handler.rb +8 -0
- data/features/support/models/alpha.rb +10 -0
- data/features/support/models/animal.rb +5 -0
- data/features/support/models/author.rb +3 -0
- data/features/support/models/beta.rb +8 -0
- data/features/support/models/box.rb +8 -0
- data/features/support/models/cat.rb +3 -0
- data/features/support/models/category.rb +4 -0
- data/features/support/models/comment.rb +10 -0
- data/features/support/models/delayed_beta.rb +7 -0
- data/features/support/models/developer.rb +16 -0
- data/features/support/models/dog.rb +3 -0
- data/features/support/models/extensible_beta.rb +9 -0
- data/features/support/models/gamma.rb +5 -0
- data/features/support/models/person.rb +23 -0
- data/features/support/models/post.rb +20 -0
- data/features/support/models/robot.rb +8 -0
- data/features/support/models/tag.rb +3 -0
- data/features/support/models/tagging.rb +4 -0
- data/features/support/models/theta.rb +7 -0
- data/features/support/post_database.rb +43 -0
- data/features/support/z.rb +19 -0
- data/lib/thinking_sphinx.rb +1 -0
- data/lib/thinking_sphinx/active_record.rb +1 -2
- data/lib/thinking_sphinx/attribute.rb +3 -2
- data/lib/thinking_sphinx/configuration.rb +2 -2
- data/lib/thinking_sphinx/deploy/capistrano.rb +1 -1
- data/lib/thinking_sphinx/excerpter.rb +1 -1
- data/lib/thinking_sphinx/search.rb +19 -0
- data/lib/thinking_sphinx/source.rb +1 -1
- data/spec/lib/thinking_sphinx/active_record_spec.rb +0 -11
- data/spec/lib/thinking_sphinx/attribute_spec.rb +14 -7
- data/spec/lib/thinking_sphinx/deltas/job_spec.rb +32 -0
- data/spec/lib/thinking_sphinx/excerpter_spec.rb +8 -0
- data/spec/lib/thinking_sphinx/search_spec.rb +52 -17
- data/tasks/distribution.rb +10 -6
- data/vendor/riddle/lib/riddle.rb +1 -1
- data/vendor/riddle/lib/riddle/client.rb +16 -3
- data/vendor/riddle/lib/riddle/controller.rb +9 -10
- metadata +98 -3
@@ -0,0 +1,43 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../../lib'
|
2
|
+
|
3
|
+
require 'lib/thinking_sphinx'
|
4
|
+
|
5
|
+
%w( tmp/config tmp/log tmp/db/sphinx/development ).each do |path|
|
6
|
+
FileUtils.mkdir_p "#{Dir.pwd}/#{path}"
|
7
|
+
end
|
8
|
+
|
9
|
+
Kernel.const_set :RAILS_ROOT, "#{Dir.pwd}/tmp" unless defined?(RAILS_ROOT)
|
10
|
+
|
11
|
+
at_exit do
|
12
|
+
ThinkingSphinx::Configuration.instance.controller.stop
|
13
|
+
sleep(1) # Ensure Sphinx has shut down completely
|
14
|
+
ActiveRecord::Base.logger.close
|
15
|
+
FileUtils.rm_r "#{Dir.pwd}/tmp"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Add log file
|
19
|
+
ActiveRecord::Base.logger = Logger.new open("tmp/active_record.log", "a")
|
20
|
+
|
21
|
+
# Set up database tables
|
22
|
+
Dir["features/support/db/migrations/*.rb"].each do |file|
|
23
|
+
require file.gsub(/\.rb$/, '')
|
24
|
+
end
|
25
|
+
|
26
|
+
# Load Models
|
27
|
+
Dir["features/support/models/*.rb"].sort.each do |file|
|
28
|
+
require file.gsub(/\.rb$/, '')
|
29
|
+
end
|
30
|
+
|
31
|
+
ThinkingSphinx.deltas_enabled = false
|
32
|
+
|
33
|
+
# Load Fixtures
|
34
|
+
Dir["features/support/db/fixtures/*.rb"].each do |file|
|
35
|
+
require file.gsub(/\.rb$/, '')
|
36
|
+
end
|
37
|
+
|
38
|
+
ThinkingSphinx.deltas_enabled = true
|
39
|
+
ThinkingSphinx.suppress_delta_output = true
|
40
|
+
|
41
|
+
ThinkingSphinx::Configuration.instance.build
|
42
|
+
ThinkingSphinx::Configuration.instance.controller.index
|
43
|
+
ThinkingSphinx::Configuration.instance.controller.start
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file exists because Cucumber likes to auto-load all ruby files
|
2
|
+
puts <<-MESSAGE
|
3
|
+
Cucumber 0.1.13 defaults to loading all ruby files within the features folder,
|
4
|
+
with something approaching reverse-alphabetical order, and preferring the
|
5
|
+
features/support folder over everything else. This is annoying, because some
|
6
|
+
files need to be loaded before others (and others perhaps not at all, given
|
7
|
+
missing dependencies). Hence this place-holder imaginatively named 'z.rb', to
|
8
|
+
force this message.
|
9
|
+
|
10
|
+
A work-around is to use cucumber profiles. You will find the default profile in
|
11
|
+
cucumber.yml should serve your needs fine, unless you add new step definitions.
|
12
|
+
When you do that, you can regenerate the YAML file by running:
|
13
|
+
rake cucumber_defaults
|
14
|
+
|
15
|
+
And then run specific features as follows is slightly more verbose, but it
|
16
|
+
works, whereas this doesn't.
|
17
|
+
cucumber -p default features/something.feature
|
18
|
+
MESSAGE
|
19
|
+
exit 0
|
data/lib/thinking_sphinx.rb
CHANGED
@@ -276,8 +276,7 @@ module ThinkingSphinx
|
|
276
276
|
"#{self.class.sphinx_indexes.first.name}_delta",
|
277
277
|
['sphinx_deleted'],
|
278
278
|
{self.sphinx_document_id => 1}
|
279
|
-
) if
|
280
|
-
self.class.sphinx_indexes.any? { |index| index.delta? } &&
|
279
|
+
) if self.class.sphinx_indexes.any? { |index| index.delta? } &&
|
281
280
|
self.toggled_delta?
|
282
281
|
rescue ::ThinkingSphinx::ConnectionError
|
283
282
|
# nothing
|
@@ -100,6 +100,9 @@ module ThinkingSphinx
|
|
100
100
|
adapter.convert_nulls(part)
|
101
101
|
when :datetime
|
102
102
|
adapter.cast_to_datetime(part)
|
103
|
+
when :multi
|
104
|
+
part = adapter.cast_to_datetime(part) if is_many_datetimes?
|
105
|
+
adapter.convert_nulls(part, 0)
|
103
106
|
else
|
104
107
|
part
|
105
108
|
end
|
@@ -151,8 +154,6 @@ module ThinkingSphinx
|
|
151
154
|
def type
|
152
155
|
@type ||= begin
|
153
156
|
base_type = case
|
154
|
-
when is_many_datetimes?
|
155
|
-
:datetime
|
156
157
|
when is_many?, is_many_ints?
|
157
158
|
:multi
|
158
159
|
when @associations.values.flatten.length > 1
|
@@ -158,8 +158,8 @@ module ThinkingSphinx
|
|
158
158
|
#
|
159
159
|
def load_models
|
160
160
|
return if defined?(Rails) &&
|
161
|
-
Rails.
|
162
|
-
Rails
|
161
|
+
Rails::VERSION::STRING.to_f > 2.1 &&
|
162
|
+
Rails.configuration.cache_classes
|
163
163
|
|
164
164
|
self.model_directories.each do |base|
|
165
165
|
Dir["#{base}**/*.rb"].each do |file|
|
@@ -45,7 +45,7 @@ DESC
|
|
45
45
|
|
46
46
|
desc "Install Thinking Sphinx as a gem from GitHub"
|
47
47
|
task :ts do
|
48
|
-
run "#{try_sudo} gem install
|
48
|
+
run "#{try_sudo} gem install thinking-sphinx --source http://gemcutter.org"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -14,7 +14,7 @@ module ThinkingSphinx
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def method_missing(method, *args, &block)
|
17
|
-
string = @instance.send(method, *args, &block).to_s
|
17
|
+
string = CGI::escapeHTML @instance.send(method, *args, &block).to_s
|
18
18
|
|
19
19
|
@search.excerpt_for(string, @instance.class)
|
20
20
|
end
|
@@ -192,6 +192,7 @@ module ThinkingSphinx
|
|
192
192
|
match[:attributes]["@count"]
|
193
193
|
end
|
194
194
|
end
|
195
|
+
alias_method :each_with_group_and_count, :each_with_groupby_and_count
|
195
196
|
|
196
197
|
def each_with_weighting(&block)
|
197
198
|
populate
|
@@ -244,6 +245,7 @@ module ThinkingSphinx
|
|
244
245
|
else
|
245
246
|
replace instances_from_matches
|
246
247
|
add_excerpter
|
248
|
+
add_sphinx_attributes
|
247
249
|
end
|
248
250
|
end
|
249
251
|
end
|
@@ -261,6 +263,23 @@ module ThinkingSphinx
|
|
261
263
|
end
|
262
264
|
end
|
263
265
|
|
266
|
+
def add_sphinx_attributes
|
267
|
+
each do |object|
|
268
|
+
next if object.nil? || object.respond_to?(:sphinx_attributes)
|
269
|
+
|
270
|
+
match = @results[:matches].detect { |match|
|
271
|
+
match[:attributes]['sphinx_internal_id'] == object.
|
272
|
+
primary_key_for_sphinx &&
|
273
|
+
match[:attributes]['class_crc'] == object.class.to_crc32
|
274
|
+
}
|
275
|
+
next if match.nil?
|
276
|
+
|
277
|
+
object.metaclass.instance_eval do
|
278
|
+
define_method(:sphinx_attributes) { match[:attributes] }
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
264
283
|
def self.log(message, method = :debug)
|
265
284
|
return if ::ActiveRecord::Base.logger.nil?
|
266
285
|
::ActiveRecord::Base.logger.send method, message
|
@@ -268,17 +268,6 @@ describe ThinkingSphinx::ActiveRecord do
|
|
268
268
|
@person.toggle_deleted
|
269
269
|
end
|
270
270
|
|
271
|
-
it "should not update the delta index if delta indexing is disabled" do
|
272
|
-
ThinkingSphinx.deltas_enabled = false
|
273
|
-
Person.sphinx_indexes.each { |index| index.stub!(:delta? => true) }
|
274
|
-
@person.delta = true
|
275
|
-
@client.should_not_receive(:update).with(
|
276
|
-
"person_delta", ["sphinx_deleted"], {@person.sphinx_document_id => 1}
|
277
|
-
)
|
278
|
-
|
279
|
-
@person.toggle_deleted
|
280
|
-
end
|
281
|
-
|
282
271
|
it "should not update either index if updates are disabled" do
|
283
272
|
ThinkingSphinx.updates_enabled = false
|
284
273
|
ThinkingSphinx.deltas_enabled = true
|
@@ -22,7 +22,7 @@ describe ThinkingSphinx::Attribute do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe '#unique_name' do
|
26
26
|
before :each do
|
27
27
|
@attribute = ThinkingSphinx::Attribute.new @source, [
|
28
28
|
stub('column', :__stack => [], :__name => "col_name")
|
@@ -47,7 +47,7 @@ describe ThinkingSphinx::Attribute do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
describe
|
50
|
+
describe '#column_with_prefix' do
|
51
51
|
before :each do
|
52
52
|
@attribute = ThinkingSphinx::Attribute.new @source, [
|
53
53
|
ThinkingSphinx::Index::FauxColumn.new(:col_name)
|
@@ -101,7 +101,7 @@ describe ThinkingSphinx::Attribute do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
describe
|
104
|
+
describe '#is_many?' do
|
105
105
|
before :each do
|
106
106
|
@assoc_a = stub('assoc', :is_many? => true)
|
107
107
|
@assoc_b = stub('assoc', :is_many? => true)
|
@@ -135,7 +135,7 @@ describe ThinkingSphinx::Attribute do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
describe
|
138
|
+
describe '#is_string?' do
|
139
139
|
before :each do
|
140
140
|
@col_a = ThinkingSphinx::Index::FauxColumn.new("a")
|
141
141
|
@col_b = ThinkingSphinx::Index::FauxColumn.new("b")
|
@@ -163,7 +163,7 @@ describe ThinkingSphinx::Attribute do
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
describe
|
166
|
+
describe '#type' do
|
167
167
|
before :each do
|
168
168
|
@column = ThinkingSphinx::Index::FauxColumn.new(:col_name)
|
169
169
|
@attribute = ThinkingSphinx::Attribute.new(@source, [@column])
|
@@ -193,9 +193,16 @@ describe ThinkingSphinx::Attribute do
|
|
193
193
|
@column.send(:instance_variable_set, :@name, "id")
|
194
194
|
@attribute.send(:type).should == :integer
|
195
195
|
end
|
196
|
+
|
197
|
+
it "should return :multi if the columns return multiple datetimes" do
|
198
|
+
@attribute.stub!(:is_many? => true)
|
199
|
+
@attribute.stub!(:all_datetimes? => true)
|
200
|
+
|
201
|
+
@attribute.type.should == :multi
|
202
|
+
end
|
196
203
|
end
|
197
204
|
|
198
|
-
describe
|
205
|
+
describe '#all_ints?' do
|
199
206
|
it "should return true if all columns are integers" do
|
200
207
|
attribute = ThinkingSphinx::Attribute.new(@source,
|
201
208
|
[ ThinkingSphinx::Index::FauxColumn.new(:id),
|
@@ -230,7 +237,7 @@ describe ThinkingSphinx::Attribute do
|
|
230
237
|
end
|
231
238
|
end
|
232
239
|
|
233
|
-
describe
|
240
|
+
describe '#all_datetimes?' do
|
234
241
|
it "should return true if all columns are datetimes" do
|
235
242
|
attribute = ThinkingSphinx::Attribute.new(@source,
|
236
243
|
[ ThinkingSphinx::Index::FauxColumn.new(:created_at),
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe ThinkingSphinx::Deltas::Job do
|
4
|
+
describe '.cancel_thinking_sphinx_jobs' do
|
5
|
+
before :each do
|
6
|
+
ThinkingSphinx::Deltas::Job.stub!(:delete_all => true)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not delete any rows if the delayed_jobs table does not exist" do
|
10
|
+
ThinkingSphinx::Deltas::Job.connection.stub!(:tables => [])
|
11
|
+
ThinkingSphinx::Deltas::Job.should_not_receive(:delete_all)
|
12
|
+
|
13
|
+
ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should delete rows if the delayed_jobs table does exist" do
|
17
|
+
ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
|
18
|
+
ThinkingSphinx::Deltas::Job.should_receive(:delete_all)
|
19
|
+
|
20
|
+
ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should delete only Thinking Sphinx jobs" do
|
24
|
+
ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
|
25
|
+
ThinkingSphinx::Deltas::Job.should_receive(:delete_all) do |sql|
|
26
|
+
sql.should match(/handler LIKE '--- !ruby\/object:ThinkingSphinx::Deltas::\%'/)
|
27
|
+
end
|
28
|
+
|
29
|
+
ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -40,6 +40,14 @@ describe ThinkingSphinx::Excerpter do
|
|
40
40
|
@excerpter.big_name
|
41
41
|
end
|
42
42
|
|
43
|
+
it "should escape the text in the excerpt" do
|
44
|
+
@search.should_receive(:excerpt_for) do |string, model|
|
45
|
+
string.should == 'test "escaping" <characters>'
|
46
|
+
end
|
47
|
+
|
48
|
+
@excerpter.string_to_escape
|
49
|
+
end
|
50
|
+
|
43
51
|
it "should still raise an exception if no column or method exists" do
|
44
52
|
lambda {
|
45
53
|
@excerpter.foo
|
@@ -732,28 +732,54 @@ describe ThinkingSphinx::Search do
|
|
732
732
|
end
|
733
733
|
end
|
734
734
|
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
735
|
+
context 'result objects' do
|
736
|
+
describe '#excerpts' do
|
737
|
+
before :each do
|
738
|
+
@search = ThinkingSphinx::Search.new
|
739
|
+
end
|
739
740
|
|
740
|
-
|
741
|
-
|
742
|
-
|
741
|
+
it "should add excerpts method if objects don't already have one" do
|
742
|
+
@search.first.should respond_to(:excerpts)
|
743
|
+
end
|
743
744
|
|
744
|
-
|
745
|
-
|
746
|
-
|
745
|
+
it "should return an instance of ThinkingSphinx::Excerpter" do
|
746
|
+
@search.first.excerpts.should be_a(ThinkingSphinx::Excerpter)
|
747
|
+
end
|
747
748
|
|
748
|
-
|
749
|
-
|
750
|
-
|
749
|
+
it "should not add excerpts method if objects already have one" do
|
750
|
+
@search.last.excerpts.should_not be_a(ThinkingSphinx::Excerpter)
|
751
|
+
end
|
751
752
|
|
752
|
-
|
753
|
-
|
754
|
-
|
753
|
+
it "should set up the excerpter with the instances and search" do
|
754
|
+
ThinkingSphinx::Excerpter.should_receive(:new).with(@search, @alpha_a)
|
755
|
+
ThinkingSphinx::Excerpter.should_receive(:new).with(@search, @alpha_b)
|
756
|
+
|
757
|
+
@search.first
|
758
|
+
end
|
759
|
+
end
|
760
|
+
|
761
|
+
describe '#sphinx_attributes' do
|
762
|
+
before :each do
|
763
|
+
@search = ThinkingSphinx::Search.new
|
764
|
+
end
|
755
765
|
|
756
|
-
|
766
|
+
it "should add sphinx_attributes method if objects don't already have one" do
|
767
|
+
@search.last.should respond_to(:sphinx_attributes)
|
768
|
+
end
|
769
|
+
|
770
|
+
it "should return a hash" do
|
771
|
+
@search.last.sphinx_attributes.should be_a(Hash)
|
772
|
+
end
|
773
|
+
|
774
|
+
it "should not add sphinx_attributes if objects have a method of that name already" do
|
775
|
+
@search.first.sphinx_attributes.should_not be_a(Hash)
|
776
|
+
end
|
777
|
+
|
778
|
+
it "should pair sphinx_attributes with the correct hash" do
|
779
|
+
hash = @search.last.sphinx_attributes
|
780
|
+
hash['sphinx_internal_id'].should == @search.last.id
|
781
|
+
hash['class_crc'].should == @search.last.class.to_crc32
|
782
|
+
end
|
757
783
|
end
|
758
784
|
end
|
759
785
|
end
|
@@ -893,6 +919,15 @@ describe ThinkingSphinx::Search do
|
|
893
919
|
count.should == 5
|
894
920
|
end
|
895
921
|
end
|
922
|
+
|
923
|
+
it "should be aliased to each_with_group_and_count" do
|
924
|
+
search = ThinkingSphinx::Search.new
|
925
|
+
search.each_with_group_and_count do |obj, group, count|
|
926
|
+
obj.should == @alpha
|
927
|
+
group.should == 101
|
928
|
+
count.should == 5
|
929
|
+
end
|
930
|
+
end
|
896
931
|
end
|
897
932
|
|
898
933
|
describe '.each_with_weighting' do
|
data/tasks/distribution.rb
CHANGED
@@ -7,11 +7,12 @@ YARD::Rake::YardocTask.new do |t|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Jeweler::Tasks.new do |gem|
|
10
|
-
gem.name
|
11
|
-
gem.summary
|
12
|
-
gem.
|
13
|
-
gem.
|
14
|
-
gem.
|
10
|
+
gem.name = "moneypools-thinking-sphinx"
|
11
|
+
gem.summary = "ActiveRecord/Rails Sphinx library"
|
12
|
+
gem.description = "A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching."
|
13
|
+
gem.author = "Pat Allan"
|
14
|
+
gem.email = "pat@freelancing-gods.com"
|
15
|
+
gem.homepage = "http://ts.freelancing-gods.com"
|
15
16
|
|
16
17
|
# s.rubyforge_project = "thinking-sphinx"
|
17
18
|
gem.files = FileList[
|
@@ -24,7 +25,10 @@ Jeweler::Tasks.new do |gem|
|
|
24
25
|
"vendor/**/*",
|
25
26
|
"VERSION.yml"
|
26
27
|
]
|
27
|
-
gem.test_files = FileList[
|
28
|
+
gem.test_files = FileList[
|
29
|
+
"features/**/*",
|
30
|
+
"spec/**/*_spec.rb"
|
31
|
+
]
|
28
32
|
|
29
33
|
gem.add_dependency 'activerecord', '>= 1.15.6'
|
30
34
|
|
data/vendor/riddle/lib/riddle.rb
CHANGED
@@ -18,7 +18,7 @@ module Riddle #:nodoc:
|
|
18
18
|
Rev = 1533
|
19
19
|
# Release number to mark my own fixes, beyond feature parity with
|
20
20
|
# Sphinx itself.
|
21
|
-
Release =
|
21
|
+
Release = 10
|
22
22
|
|
23
23
|
String = [Major, Minor, Tiny].join('.')
|
24
24
|
GemVersion = [Major, Minor, Tiny, Rev, Release].join('.')
|