thinking-sphinx 1.3.4 → 1.3.6
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.
- data/README.textile +15 -4
- data/VERSION +1 -0
- data/features/alternate_primary_key.feature +1 -1
- data/features/attribute_updates.feature +11 -5
- data/features/deleting_instances.feature +3 -0
- data/features/searching_by_index.feature +40 -0
- data/features/step_definitions/alpha_steps.rb +5 -1
- data/features/step_definitions/beta_steps.rb +1 -1
- data/features/step_definitions/common_steps.rb +12 -1
- data/features/step_definitions/sphinx_steps.rb +8 -4
- data/features/support/db/fixtures/tags.rb +1 -1
- data/features/support/env.rb +3 -0
- data/features/support/models/alpha.rb +11 -0
- data/lib/cucumber/thinking_sphinx/internal_world.rb +7 -6
- data/lib/thinking_sphinx.rb +40 -31
- data/lib/thinking_sphinx/active_record.rb +164 -195
- data/lib/thinking_sphinx/active_record/attribute_updates.rb +9 -6
- data/lib/thinking_sphinx/configuration.rb +1 -1
- data/lib/thinking_sphinx/deltas/default_delta.rb +14 -20
- data/lib/thinking_sphinx/index.rb +76 -19
- data/lib/thinking_sphinx/index/builder.rb +2 -2
- data/lib/thinking_sphinx/search.rb +7 -0
- data/lib/thinking_sphinx/search_methods.rb +22 -4
- data/lib/thinking_sphinx/source.rb +6 -6
- data/lib/thinking_sphinx/source/sql.rb +4 -2
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record/delta_spec.rb +4 -6
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record/has_many_association_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record/scopes_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/active_record_spec.rb +254 -94
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/association_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/attribute_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/configuration_spec.rb +2 -2
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/core/array_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/core/string_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/excerpter_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/facet_search_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/facet_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/field_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/index/builder_spec.rb +10 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/index/faux_column_spec.rb +0 -0
- data/spec/thinking_sphinx/index_spec.rb +177 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/rails_additions_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/search_methods_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/search_spec.rb +33 -0
- data/spec/{lib/thinking_sphinx → thinking_sphinx}/source_spec.rb +0 -0
- data/spec/{lib/thinking_sphinx_spec.rb → thinking_sphinx_spec.rb} +62 -50
- data/tasks/distribution.rb +3 -3
- metadata +27 -31
- data/VERSION.yml +0 -5
- data/features/support/db/active_record.rb +0 -40
- data/features/support/db/database.yml +0 -5
- data/features/support/db/mysql.rb +0 -3
- data/features/support/db/postgresql.rb +0 -3
- data/features/support/post_database.rb +0 -43
- data/spec/lib/thinking_sphinx/index_spec.rb +0 -45
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-26 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.
|
33
|
+
version: 1.0.2
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: after_commit
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.0.
|
43
|
+
version: 1.0.5
|
44
44
|
version:
|
45
45
|
description: A concise and easy-to-use Ruby library that connects ActiveRecord to the Sphinx search daemon, managing configuration, indexing and searching.
|
46
46
|
email: pat@freelancing-gods.com
|
@@ -53,7 +53,7 @@ extra_rdoc_files:
|
|
53
53
|
files:
|
54
54
|
- LICENCE
|
55
55
|
- README.textile
|
56
|
-
- VERSION
|
56
|
+
- VERSION
|
57
57
|
- lib/cucumber/thinking_sphinx/external_world.rb
|
58
58
|
- lib/cucumber/thinking_sphinx/internal_world.rb
|
59
59
|
- lib/cucumber/thinking_sphinx/sql_logger.rb
|
@@ -141,6 +141,7 @@ test_files:
|
|
141
141
|
- features/handling_edits.feature
|
142
142
|
- features/retry_stale_indexes.feature
|
143
143
|
- features/searching_across_models.feature
|
144
|
+
- features/searching_by_index.feature
|
144
145
|
- features/searching_by_model.feature
|
145
146
|
- features/searching_with_find_arguments.feature
|
146
147
|
- features/sphinx_detection.feature
|
@@ -158,8 +159,6 @@ test_files:
|
|
158
159
|
- features/sti_searching.feature
|
159
160
|
- features/support/database.example.yml
|
160
161
|
- features/support/database.yml
|
161
|
-
- features/support/db/active_record.rb
|
162
|
-
- features/support/db/database.yml
|
163
162
|
- features/support/db/fixtures/alphas.rb
|
164
163
|
- features/support/db/fixtures/authors.rb
|
165
164
|
- features/support/db/fixtures/betas.rb
|
@@ -191,8 +190,6 @@ test_files:
|
|
191
190
|
- features/support/db/migrations/create_robots.rb
|
192
191
|
- features/support/db/migrations/create_taggings.rb
|
193
192
|
- features/support/db/migrations/create_tags.rb
|
194
|
-
- features/support/db/mysql.rb
|
195
|
-
- features/support/db/postgresql.rb
|
196
193
|
- features/support/env.rb
|
197
194
|
- features/support/lib/generic_delta_handler.rb
|
198
195
|
- features/support/models/alpha.rb
|
@@ -212,25 +209,24 @@ test_files:
|
|
212
209
|
- features/support/models/robot.rb
|
213
210
|
- features/support/models/tag.rb
|
214
211
|
- features/support/models/tagging.rb
|
215
|
-
-
|
216
|
-
- spec/
|
217
|
-
- spec/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
220
|
-
- spec/
|
221
|
-
- spec/
|
222
|
-
- spec/
|
223
|
-
- spec/
|
224
|
-
- spec/
|
225
|
-
- spec/
|
226
|
-
- spec/
|
227
|
-
- spec/
|
228
|
-
- spec/
|
229
|
-
- spec/
|
230
|
-
- spec/
|
231
|
-
- spec/
|
232
|
-
- spec/
|
233
|
-
- spec/
|
234
|
-
- spec/
|
235
|
-
- spec/
|
236
|
-
- spec/lib/thinking_sphinx_spec.rb
|
212
|
+
- spec/thinking_sphinx/active_record/delta_spec.rb
|
213
|
+
- spec/thinking_sphinx/active_record/has_many_association_spec.rb
|
214
|
+
- spec/thinking_sphinx/active_record/scopes_spec.rb
|
215
|
+
- spec/thinking_sphinx/active_record_spec.rb
|
216
|
+
- spec/thinking_sphinx/association_spec.rb
|
217
|
+
- spec/thinking_sphinx/attribute_spec.rb
|
218
|
+
- spec/thinking_sphinx/configuration_spec.rb
|
219
|
+
- spec/thinking_sphinx/core/array_spec.rb
|
220
|
+
- spec/thinking_sphinx/core/string_spec.rb
|
221
|
+
- spec/thinking_sphinx/excerpter_spec.rb
|
222
|
+
- spec/thinking_sphinx/facet_search_spec.rb
|
223
|
+
- spec/thinking_sphinx/facet_spec.rb
|
224
|
+
- spec/thinking_sphinx/field_spec.rb
|
225
|
+
- spec/thinking_sphinx/index/builder_spec.rb
|
226
|
+
- spec/thinking_sphinx/index/faux_column_spec.rb
|
227
|
+
- spec/thinking_sphinx/index_spec.rb
|
228
|
+
- spec/thinking_sphinx/rails_additions_spec.rb
|
229
|
+
- spec/thinking_sphinx/search_methods_spec.rb
|
230
|
+
- spec/thinking_sphinx/search_spec.rb
|
231
|
+
- spec/thinking_sphinx/source_spec.rb
|
232
|
+
- spec/thinking_sphinx_spec.rb
|
data/VERSION.yml
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'active_record'
|
3
|
-
|
4
|
-
# Database Defaults
|
5
|
-
host = "localhost"
|
6
|
-
username = "thinking_sphinx"
|
7
|
-
password = nil
|
8
|
-
|
9
|
-
# Read in YAML file
|
10
|
-
if File.exist?("features/support/db/database.yml")
|
11
|
-
config = YAML.load open("features/support/db/database.yml")
|
12
|
-
host = config["host"] || host
|
13
|
-
username = config["username"] || username
|
14
|
-
password = config["password"] || password
|
15
|
-
end
|
16
|
-
|
17
|
-
# Set up Connection
|
18
|
-
ActiveRecord::Base.establish_connection(
|
19
|
-
:adapter => Database,
|
20
|
-
:database => 'thinking_sphinx',
|
21
|
-
:username => username,
|
22
|
-
:password => password,
|
23
|
-
:host => host
|
24
|
-
)
|
25
|
-
|
26
|
-
# Copied from ActiveRecord's test suite
|
27
|
-
ActiveRecord::Base.connection.class.class_eval do
|
28
|
-
IGNORED_SQL = [
|
29
|
-
/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/,
|
30
|
-
/^SELECT @@ROWCOUNT/, /^SHOW FIELDS/
|
31
|
-
]
|
32
|
-
|
33
|
-
def execute_with_query_record(sql, name = nil, &block)
|
34
|
-
$queries_executed ||= []
|
35
|
-
$queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
|
36
|
-
execute_without_query_record(sql, name, &block)
|
37
|
-
end
|
38
|
-
|
39
|
-
alias_method_chain :execute, :query_record
|
40
|
-
end
|
@@ -1,43 +0,0 @@
|
|
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
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec/spec_helper'
|
2
|
-
|
3
|
-
describe ThinkingSphinx::Index do
|
4
|
-
describe "prefix_fields method" do
|
5
|
-
before :each do
|
6
|
-
@index = ThinkingSphinx::Index.new(Person)
|
7
|
-
|
8
|
-
@field_a = stub('field', :prefixes => true)
|
9
|
-
@field_b = stub('field', :prefixes => false)
|
10
|
-
@field_c = stub('field', :prefixes => true)
|
11
|
-
|
12
|
-
@index.stub!(:fields => [@field_a, @field_b, @field_c])
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should return fields that are flagged as prefixed" do
|
16
|
-
@index.prefix_fields.should include(@field_a)
|
17
|
-
@index.prefix_fields.should include(@field_c)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should not return fields that aren't flagged as prefixed" do
|
21
|
-
@index.prefix_fields.should_not include(@field_b)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "infix_fields method" do
|
26
|
-
before :each do
|
27
|
-
@index = ThinkingSphinx::Index.new(Person)
|
28
|
-
|
29
|
-
@field_a = stub('field', :infixes => true)
|
30
|
-
@field_b = stub('field', :infixes => false)
|
31
|
-
@field_c = stub('field', :infixes => true)
|
32
|
-
|
33
|
-
@index.stub!(:fields => [@field_a, @field_b, @field_c])
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should return fields that are flagged as infixed" do
|
37
|
-
@index.infix_fields.should include(@field_a)
|
38
|
-
@index.infix_fields.should include(@field_c)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should not return fields that aren't flagged as infixed" do
|
42
|
-
@index.infix_fields.should_not include(@field_b)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|