thinking-sphinx 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/HISTORY +25 -0
- data/README.textile +2 -2
- data/lib/thinking_sphinx.rb +5 -0
- data/lib/thinking_sphinx/active_record/callbacks/update_callbacks.rb +1 -1
- data/lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb +1 -1
- data/lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb +1 -1
- data/lib/thinking_sphinx/active_record/property_sql_presenter.rb +10 -2
- data/lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb +6 -7
- data/lib/thinking_sphinx/active_record/sql_builder/query.rb +8 -4
- data/lib/thinking_sphinx/active_record/sql_builder/statement.rb +7 -4
- data/lib/thinking_sphinx/active_record/sql_source.rb +1 -1
- data/lib/thinking_sphinx/configuration.rb +8 -3
- data/lib/thinking_sphinx/connection.rb +2 -0
- data/lib/thinking_sphinx/deletion.rb +1 -1
- data/lib/thinking_sphinx/deltas.rb +1 -1
- data/lib/thinking_sphinx/deltas/delete_job.rb +1 -1
- data/lib/thinking_sphinx/errors.rb +8 -0
- data/lib/thinking_sphinx/excerpter.rb +2 -2
- data/lib/thinking_sphinx/facet.rb +2 -2
- data/lib/thinking_sphinx/facet_search.rb +2 -1
- data/lib/thinking_sphinx/float_formatter.rb +33 -0
- data/lib/thinking_sphinx/index_set.rb +2 -4
- data/lib/thinking_sphinx/masks/group_enumerators_mask.rb +4 -3
- data/lib/thinking_sphinx/masks/scopes_mask.rb +5 -0
- data/lib/thinking_sphinx/masks/weight_enumerator_mask.rb +1 -1
- data/lib/thinking_sphinx/middlewares/active_record_translator.rb +6 -1
- data/lib/thinking_sphinx/middlewares/geographer.rb +10 -4
- data/lib/thinking_sphinx/middlewares/sphinxql.rb +14 -11
- data/lib/thinking_sphinx/middlewares/utf8.rb +2 -3
- data/lib/thinking_sphinx/panes/weight_pane.rb +1 -1
- data/lib/thinking_sphinx/rake_interface.rb +9 -7
- data/lib/thinking_sphinx/real_time/interpreter.rb +18 -0
- data/lib/thinking_sphinx/real_time/property.rb +4 -2
- data/lib/thinking_sphinx/search.rb +11 -10
- data/lib/thinking_sphinx/sphinxql.rb +17 -0
- data/lib/thinking_sphinx/tasks.rb +5 -1
- data/lib/thinking_sphinx/utf8.rb +16 -0
- data/spec/acceptance/attribute_access_spec.rb +4 -2
- data/spec/acceptance/searching_within_a_model_spec.rb +6 -0
- data/spec/acceptance/sorting_search_results_spec.rb +7 -0
- data/spec/acceptance/support/sphinx_controller.rb +5 -0
- data/spec/internal/app/indices/city_index.rb +1 -0
- data/spec/internal/app/indices/product_index.rb +1 -1
- data/spec/internal/tmp/.gitkeep +0 -0
- data/spec/thinking_sphinx/active_record/base_spec.rb +10 -0
- data/spec/thinking_sphinx/active_record/callbacks/update_callbacks_spec.rb +3 -2
- data/spec/thinking_sphinx/active_record/database_adapters/mysql_adapter_spec.rb +1 -1
- data/spec/thinking_sphinx/active_record/database_adapters/postgresql_adapter_spec.rb +2 -2
- data/spec/thinking_sphinx/active_record/field_spec.rb +13 -0
- data/spec/thinking_sphinx/active_record/property_sql_presenter_spec.rb +13 -0
- data/spec/thinking_sphinx/active_record/sql_builder_spec.rb +62 -2
- data/spec/thinking_sphinx/configuration_spec.rb +1 -1
- data/spec/thinking_sphinx/deletion_spec.rb +4 -2
- data/spec/thinking_sphinx/deltas/default_delta_spec.rb +2 -1
- data/spec/thinking_sphinx/deltas_spec.rb +17 -6
- data/spec/thinking_sphinx/errors_spec.rb +7 -0
- data/spec/thinking_sphinx/facet_search_spec.rb +6 -6
- data/spec/thinking_sphinx/masks/scopes_mask_spec.rb +64 -0
- data/spec/thinking_sphinx/middlewares/active_record_translator_spec.rb +17 -1
- data/spec/thinking_sphinx/middlewares/geographer_spec.rb +11 -0
- data/spec/thinking_sphinx/middlewares/sphinxql_spec.rb +11 -0
- data/spec/thinking_sphinx/panes/weight_pane_spec.rb +1 -1
- data/spec/thinking_sphinx/rake_interface_spec.rb +6 -0
- data/spec/thinking_sphinx/real_time/field_spec.rb +13 -0
- data/spec/thinking_sphinx/real_time/interpreter_spec.rb +40 -0
- data/thinking-sphinx.gemspec +3 -2
- metadata +12 -8
- data/spec/internal/.gitignore +0 -1
@@ -6,11 +6,14 @@ module ActiveRecord
|
|
6
6
|
class Base; end
|
7
7
|
end
|
8
8
|
|
9
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
9
10
|
require 'active_support/core_ext/module/delegation'
|
10
11
|
require 'active_support/core_ext/object/blank'
|
11
12
|
require 'active_support/core_ext/string/inflections'
|
12
13
|
require 'thinking_sphinx/middlewares/middleware'
|
13
14
|
require 'thinking_sphinx/middlewares/sphinxql'
|
15
|
+
require 'thinking_sphinx/errors'
|
16
|
+
require 'thinking_sphinx/sphinxql'
|
14
17
|
|
15
18
|
describe ThinkingSphinx::Middlewares::SphinxQL do
|
16
19
|
let(:app) { double('app', :call => true) }
|
@@ -58,6 +61,14 @@ describe ThinkingSphinx::Middlewares::SphinxQL do
|
|
58
61
|
middleware.call [context]
|
59
62
|
end
|
60
63
|
|
64
|
+
it "raises an exception if there's no matching indices" do
|
65
|
+
index_set.clear
|
66
|
+
|
67
|
+
expect {
|
68
|
+
middleware.call [context]
|
69
|
+
}.to raise_error(ThinkingSphinx::NoIndicesError)
|
70
|
+
end
|
71
|
+
|
61
72
|
it "generates a Sphinx query from the provided keyword and conditions" do
|
62
73
|
search.stub :query => 'tasty'
|
63
74
|
search.options[:conditions] = {:title => 'pancakes'}
|
@@ -105,6 +105,12 @@ describe ThinkingSphinx::RakeInterface do
|
|
105
105
|
|
106
106
|
interface.index
|
107
107
|
end
|
108
|
+
|
109
|
+
it "does not index verbosely if requested" do
|
110
|
+
controller.should_receive(:index).with(:verbose => false)
|
111
|
+
|
112
|
+
interface.index true, false
|
113
|
+
end
|
108
114
|
end
|
109
115
|
|
110
116
|
describe '#start' do
|
@@ -4,6 +4,19 @@ describe ThinkingSphinx::RealTime::Field do
|
|
4
4
|
let(:field) { ThinkingSphinx::RealTime::Field.new column }
|
5
5
|
let(:column) { double('column', :__name => :created_at, :__stack => []) }
|
6
6
|
|
7
|
+
describe '#column' do
|
8
|
+
it 'returns the provided Column object' do
|
9
|
+
field.column.should == column
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'translates symbols to Column objects' do
|
13
|
+
ThinkingSphinx::ActiveRecord::Column.should_receive(:new).with(:title).
|
14
|
+
and_return(column)
|
15
|
+
|
16
|
+
ThinkingSphinx::RealTime::Field.new :title
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
7
20
|
describe '#name' do
|
8
21
|
it "uses the provided option by default" do
|
9
22
|
field = ThinkingSphinx::RealTime::Field.new column, :as => :foo
|
@@ -98,6 +98,46 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
98
98
|
saved_field == field
|
99
99
|
}.length.should == 2
|
100
100
|
end
|
101
|
+
|
102
|
+
context 'sortable' do
|
103
|
+
let(:attribute) { double('attribute') }
|
104
|
+
|
105
|
+
before :each do
|
106
|
+
ThinkingSphinx::RealTime::Attribute.stub! :new => attribute
|
107
|
+
|
108
|
+
column.stub :__name => :col
|
109
|
+
end
|
110
|
+
|
111
|
+
it "adds the _sort suffix to the field's name" do
|
112
|
+
ThinkingSphinx::RealTime::Attribute.should_receive(:new).
|
113
|
+
with(column, :as => :col_sort, :type => :string).
|
114
|
+
and_return(attribute)
|
115
|
+
|
116
|
+
instance.indexes column, :sortable => true
|
117
|
+
end
|
118
|
+
|
119
|
+
it "respects given aliases" do
|
120
|
+
ThinkingSphinx::RealTime::Attribute.should_receive(:new).
|
121
|
+
with(column, :as => :other_sort, :type => :string).
|
122
|
+
and_return(attribute)
|
123
|
+
|
124
|
+
instance.indexes column, :sortable => true, :as => :other
|
125
|
+
end
|
126
|
+
|
127
|
+
it "respects symbols instead of columns" do
|
128
|
+
ThinkingSphinx::RealTime::Attribute.should_receive(:new).
|
129
|
+
with(:title, :as => :title_sort, :type => :string).
|
130
|
+
and_return(attribute)
|
131
|
+
|
132
|
+
instance.indexes :title, :sortable => true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "adds an attribute to the index" do
|
136
|
+
instance.indexes column, :sortable => true
|
137
|
+
|
138
|
+
index.attributes.should include(attribute)
|
139
|
+
end
|
140
|
+
end
|
101
141
|
end
|
102
142
|
|
103
143
|
describe '#method_missing' do
|
data/thinking-sphinx.gemspec
CHANGED
@@ -3,13 +3,14 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'thinking-sphinx'
|
6
|
-
s.version = '3.0.
|
6
|
+
s.version = '3.0.6'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ["Pat Allan"]
|
9
9
|
s.email = ["pat@freelancing-gods.com"]
|
10
10
|
s.homepage = 'http://pat.github.com/ts/en'
|
11
11
|
s.summary = 'A smart wrapper over Sphinx for ActiveRecord'
|
12
12
|
s.description = %Q{An intelligent layer for ActiveRecord (via Rails and Sinatra) for the Sphinx full-text search tool.}
|
13
|
+
s.license = 'MIT'
|
13
14
|
|
14
15
|
s.rubyforge_project = 'thinking-sphinx'
|
15
16
|
|
@@ -24,7 +25,7 @@ Gem::Specification.new do |s|
|
|
24
25
|
s.add_runtime_dependency 'builder', '>= 2.1.2'
|
25
26
|
s.add_runtime_dependency 'middleware', '>= 0.1.0'
|
26
27
|
s.add_runtime_dependency 'innertube', '>= 1.0.2'
|
27
|
-
s.add_runtime_dependency 'riddle', '>= 1.5.
|
28
|
+
s.add_runtime_dependency 'riddle', '>= 1.5.9'
|
28
29
|
|
29
30
|
s.add_development_dependency 'appraisal', '~> 0.4.0'
|
30
31
|
s.add_development_dependency 'combustion', '~> 0.4.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thinking-sphinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.5.
|
75
|
+
version: 1.5.9
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.5.
|
82
|
+
version: 1.5.9
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: appraisal
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,6 +215,7 @@ files:
|
|
215
215
|
- lib/thinking_sphinx/excerpter.rb
|
216
216
|
- lib/thinking_sphinx/facet.rb
|
217
217
|
- lib/thinking_sphinx/facet_search.rb
|
218
|
+
- lib/thinking_sphinx/float_formatter.rb
|
218
219
|
- lib/thinking_sphinx/frameworks.rb
|
219
220
|
- lib/thinking_sphinx/frameworks/plain.rb
|
220
221
|
- lib/thinking_sphinx/frameworks/rails.rb
|
@@ -262,9 +263,11 @@ files:
|
|
262
263
|
- lib/thinking_sphinx/search/query.rb
|
263
264
|
- lib/thinking_sphinx/search/stale_ids_exception.rb
|
264
265
|
- lib/thinking_sphinx/sinatra.rb
|
266
|
+
- lib/thinking_sphinx/sphinxql.rb
|
265
267
|
- lib/thinking_sphinx/subscribers/populator_subscriber.rb
|
266
268
|
- lib/thinking_sphinx/tasks.rb
|
267
269
|
- lib/thinking_sphinx/test.rb
|
270
|
+
- lib/thinking_sphinx/utf8.rb
|
268
271
|
- sketchpad.rb
|
269
272
|
- spec/acceptance/association_scoping_spec.rb
|
270
273
|
- spec/acceptance/attribute_access_spec.rb
|
@@ -295,7 +298,6 @@ files:
|
|
295
298
|
- spec/acceptance/support/sphinx_helpers.rb
|
296
299
|
- spec/acceptance/suspended_deltas_spec.rb
|
297
300
|
- spec/fixtures/database.yml
|
298
|
-
- spec/internal/.gitignore
|
299
301
|
- spec/internal/app/indices/admin_person_index.rb
|
300
302
|
- spec/internal/app/indices/animal_index.rb
|
301
303
|
- spec/internal/app/indices/article_index.rb
|
@@ -327,6 +329,7 @@ files:
|
|
327
329
|
- spec/internal/config/database.yml
|
328
330
|
- spec/internal/db/schema.rb
|
329
331
|
- spec/internal/log/.gitignore
|
332
|
+
- spec/internal/tmp/.gitkeep
|
330
333
|
- spec/spec_helper.rb
|
331
334
|
- spec/support/sphinx_yaml_helpers.rb
|
332
335
|
- spec/thinking_sphinx/active_record/association_spec.rb
|
@@ -385,7 +388,8 @@ files:
|
|
385
388
|
- spec/thinking_sphinx_spec.rb
|
386
389
|
- thinking-sphinx.gemspec
|
387
390
|
homepage: http://pat.github.com/ts/en
|
388
|
-
licenses:
|
391
|
+
licenses:
|
392
|
+
- MIT
|
389
393
|
metadata: {}
|
390
394
|
post_install_message:
|
391
395
|
rdoc_options: []
|
@@ -403,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
403
407
|
version: '0'
|
404
408
|
requirements: []
|
405
409
|
rubyforge_project: thinking-sphinx
|
406
|
-
rubygems_version: 2.
|
410
|
+
rubygems_version: 2.1.2
|
407
411
|
signing_key:
|
408
412
|
specification_version: 4
|
409
413
|
summary: A smart wrapper over Sphinx for ActiveRecord
|
@@ -437,7 +441,6 @@ test_files:
|
|
437
441
|
- spec/acceptance/support/sphinx_helpers.rb
|
438
442
|
- spec/acceptance/suspended_deltas_spec.rb
|
439
443
|
- spec/fixtures/database.yml
|
440
|
-
- spec/internal/.gitignore
|
441
444
|
- spec/internal/app/indices/admin_person_index.rb
|
442
445
|
- spec/internal/app/indices/animal_index.rb
|
443
446
|
- spec/internal/app/indices/article_index.rb
|
@@ -469,6 +472,7 @@ test_files:
|
|
469
472
|
- spec/internal/config/database.yml
|
470
473
|
- spec/internal/db/schema.rb
|
471
474
|
- spec/internal/log/.gitignore
|
475
|
+
- spec/internal/tmp/.gitkeep
|
472
476
|
- spec/spec_helper.rb
|
473
477
|
- spec/support/sphinx_yaml_helpers.rb
|
474
478
|
- spec/thinking_sphinx/active_record/association_spec.rb
|
data/spec/internal/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
tmp
|