thinking-sphinx 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/Appraisals +13 -0
  4. data/Gemfile +2 -1
  5. data/HISTORY +19 -0
  6. data/README.textile +3 -2
  7. data/gemfiles/rails_3_2.gemfile +2 -1
  8. data/gemfiles/rails_4_0.gemfile +2 -1
  9. data/gemfiles/rails_4_1.gemfile +2 -1
  10. data/gemfiles/rails_4_2.gemfile +2 -1
  11. data/gemfiles/rails_5_0.gemfile +12 -0
  12. data/lib/thinking_sphinx.rb +2 -0
  13. data/lib/thinking_sphinx/active_record/attribute/type.rb +17 -3
  14. data/lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb +12 -4
  15. data/lib/thinking_sphinx/active_record/database_adapters.rb +1 -1
  16. data/lib/thinking_sphinx/active_record/sql_builder/query.rb +4 -0
  17. data/lib/thinking_sphinx/active_record/sql_source.rb +1 -1
  18. data/lib/thinking_sphinx/configuration.rb +3 -2
  19. data/lib/thinking_sphinx/connection.rb +23 -10
  20. data/lib/thinking_sphinx/deltas/index_job.rb +6 -2
  21. data/lib/thinking_sphinx/errors.rb +25 -0
  22. data/lib/thinking_sphinx/middlewares/active_record_translator.rb +14 -2
  23. data/lib/thinking_sphinx/railtie.rb +1 -1
  24. data/lib/thinking_sphinx/rake_interface.rb +71 -23
  25. data/lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb +15 -7
  26. data/lib/thinking_sphinx/real_time/populator.rb +3 -3
  27. data/lib/thinking_sphinx/tasks.rb +7 -8
  28. data/lib/thinking_sphinx/wildcard.rb +1 -1
  29. data/spec/acceptance/association_scoping_spec.rb +5 -5
  30. data/spec/acceptance/attribute_access_spec.rb +4 -4
  31. data/spec/acceptance/attribute_updates_spec.rb +3 -3
  32. data/spec/acceptance/batch_searching_spec.rb +4 -4
  33. data/spec/acceptance/big_integers_spec.rb +6 -6
  34. data/spec/acceptance/connection_spec.rb +23 -0
  35. data/spec/acceptance/excerpts_spec.rb +8 -8
  36. data/spec/acceptance/facets_spec.rb +13 -13
  37. data/spec/acceptance/geosearching_spec.rb +8 -8
  38. data/spec/acceptance/grouping_by_attributes_spec.rb +10 -10
  39. data/spec/acceptance/index_options_spec.rb +16 -16
  40. data/spec/acceptance/indexing_spec.rb +3 -3
  41. data/spec/acceptance/paginating_search_results_spec.rb +3 -3
  42. data/spec/acceptance/real_time_updates_spec.rb +4 -4
  43. data/spec/acceptance/remove_deleted_records_spec.rb +12 -12
  44. data/spec/acceptance/search_counts_spec.rb +2 -2
  45. data/spec/acceptance/search_for_just_ids_spec.rb +2 -2
  46. data/spec/acceptance/searching_across_models_spec.rb +6 -6
  47. data/spec/acceptance/searching_across_schemas_spec.rb +10 -10
  48. data/spec/acceptance/searching_on_fields_spec.rb +9 -9
  49. data/spec/acceptance/searching_with_filters_spec.rb +16 -16
  50. data/spec/acceptance/searching_with_sti_spec.rb +9 -9
  51. data/spec/acceptance/searching_within_a_model_spec.rb +17 -17
  52. data/spec/acceptance/sorting_search_results_spec.rb +6 -6
  53. data/spec/acceptance/specifying_sql_spec.rb +62 -62
  54. data/spec/acceptance/sphinx_scopes_spec.rb +9 -9
  55. data/spec/acceptance/sql_deltas_spec.rb +7 -7
  56. data/spec/acceptance/support/database_cleaner.rb +1 -1
  57. data/spec/acceptance/support/sphinx_controller.rb +4 -1
  58. data/spec/acceptance/support/sphinx_helpers.rb +4 -0
  59. data/spec/acceptance/suspended_deltas_spec.rb +9 -9
  60. data/spec/internal/app/indices/article_index.rb +2 -2
  61. data/spec/internal/app/indices/book_index.rb +2 -1
  62. data/spec/internal/app/indices/product_index.rb +0 -2
  63. data/spec/internal/app/models/categorisation.rb +8 -1
  64. data/spec/spec_helper.rb +2 -0
  65. data/spec/support/json_column.rb +5 -1
  66. data/spec/support/multi_schema.rb +3 -1
  67. data/spec/support/sphinx_yaml_helpers.rb +1 -1
  68. data/spec/thinking_sphinx/active_record/association_spec.rb +1 -1
  69. data/spec/thinking_sphinx/active_record/attribute/type_spec.rb +41 -38
  70. data/spec/thinking_sphinx/active_record/base_spec.rb +29 -29
  71. data/spec/thinking_sphinx/active_record/callbacks/delete_callbacks_spec.rb +10 -10
  72. data/spec/thinking_sphinx/active_record/callbacks/delta_callbacks_spec.rb +48 -25
  73. data/spec/thinking_sphinx/active_record/callbacks/update_callbacks_spec.rb +8 -8
  74. data/spec/thinking_sphinx/active_record/column_spec.rb +13 -13
  75. data/spec/thinking_sphinx/active_record/column_sql_presenter_spec.rb +5 -5
  76. data/spec/thinking_sphinx/active_record/database_adapters/abstract_adapter_spec.rb +5 -5
  77. data/spec/thinking_sphinx/active_record/database_adapters/mysql_adapter_spec.rb +11 -11
  78. data/spec/thinking_sphinx/active_record/database_adapters/postgresql_adapter_spec.rb +13 -13
  79. data/spec/thinking_sphinx/active_record/database_adapters_spec.rb +48 -48
  80. data/spec/thinking_sphinx/active_record/field_spec.rb +7 -7
  81. data/spec/thinking_sphinx/active_record/filter_reflection_spec.rb +32 -32
  82. data/spec/thinking_sphinx/active_record/index_spec.rb +35 -36
  83. data/spec/thinking_sphinx/active_record/interpreter_spec.rb +51 -51
  84. data/spec/thinking_sphinx/active_record/polymorpher_spec.rb +14 -14
  85. data/spec/thinking_sphinx/active_record/property_sql_presenter_spec.rb +67 -67
  86. data/spec/thinking_sphinx/active_record/sql_builder_spec.rb +140 -140
  87. data/spec/thinking_sphinx/active_record/sql_source_spec.rb +97 -95
  88. data/spec/thinking_sphinx/configuration_spec.rb +81 -81
  89. data/spec/thinking_sphinx/connection_spec.rb +13 -13
  90. data/spec/thinking_sphinx/deletion_spec.rb +11 -11
  91. data/spec/thinking_sphinx/deltas/default_delta_spec.rb +20 -20
  92. data/spec/thinking_sphinx/deltas_spec.rb +12 -12
  93. data/spec/thinking_sphinx/errors_spec.rb +30 -30
  94. data/spec/thinking_sphinx/excerpter_spec.rb +7 -7
  95. data/spec/thinking_sphinx/facet_search_spec.rb +16 -16
  96. data/spec/thinking_sphinx/index_set_spec.rb +7 -7
  97. data/spec/thinking_sphinx/index_spec.rb +24 -24
  98. data/spec/thinking_sphinx/masks/pagination_mask_spec.rb +20 -20
  99. data/spec/thinking_sphinx/masks/scopes_mask_spec.rb +18 -18
  100. data/spec/thinking_sphinx/middlewares/active_record_translator_spec.rb +22 -22
  101. data/spec/thinking_sphinx/middlewares/geographer_spec.rb +9 -9
  102. data/spec/thinking_sphinx/middlewares/glazier_spec.rb +4 -4
  103. data/spec/thinking_sphinx/middlewares/inquirer_spec.rb +7 -7
  104. data/spec/thinking_sphinx/middlewares/sphinxql_spec.rb +53 -53
  105. data/spec/thinking_sphinx/middlewares/stale_id_checker_spec.rb +5 -5
  106. data/spec/thinking_sphinx/middlewares/stale_id_filter_spec.rb +15 -15
  107. data/spec/thinking_sphinx/panes/attributes_pane_spec.rb +1 -1
  108. data/spec/thinking_sphinx/panes/distance_pane_spec.rb +4 -4
  109. data/spec/thinking_sphinx/panes/excerpts_pane_spec.rb +5 -5
  110. data/spec/thinking_sphinx/panes/weight_pane_spec.rb +1 -1
  111. data/spec/thinking_sphinx/rake_interface_spec.rb +66 -53
  112. data/spec/thinking_sphinx/real_time/attribute_spec.rb +13 -13
  113. data/spec/thinking_sphinx/real_time/callbacks/real_time_callbacks_spec.rb +107 -23
  114. data/spec/thinking_sphinx/real_time/field_spec.rb +14 -14
  115. data/spec/thinking_sphinx/real_time/index_spec.rb +29 -30
  116. data/spec/thinking_sphinx/real_time/interpreter_spec.rb +30 -30
  117. data/spec/thinking_sphinx/scopes_spec.rb +5 -5
  118. data/spec/thinking_sphinx/search/glaze_spec.rb +15 -15
  119. data/spec/thinking_sphinx/search/query_spec.rb +10 -10
  120. data/spec/thinking_sphinx/search_spec.rb +28 -28
  121. data/spec/thinking_sphinx/wildcard_spec.rb +16 -11
  122. data/spec/thinking_sphinx_spec.rb +6 -6
  123. data/thinking-sphinx.gemspec +4 -4
  124. metadata +12 -9
@@ -6,41 +6,46 @@ require './lib/thinking_sphinx/wildcard'
6
6
  describe ThinkingSphinx::Wildcard do
7
7
  describe '.call' do
8
8
  it "does not star quorum operators" do
9
- ThinkingSphinx::Wildcard.call("foo/3").should == "*foo*/3"
9
+ expect(ThinkingSphinx::Wildcard.call("foo/3")).to eq("*foo*/3")
10
10
  end
11
11
 
12
12
  it "does not star proximity operators or quoted strings" do
13
- ThinkingSphinx::Wildcard.call(%q{"hello world"~3}).
14
- should == %q{"hello world"~3}
13
+ expect(ThinkingSphinx::Wildcard.call(%q{"hello world"~3})).
14
+ to eq(%q{"hello world"~3})
15
15
  end
16
16
 
17
17
  it "treats slashes as a separator when starring" do
18
- ThinkingSphinx::Wildcard.call("a\\/c").should == "*a*\\/*c*"
18
+ expect(ThinkingSphinx::Wildcard.call("a\\/c")).to eq("*a*\\/*c*")
19
19
  end
20
20
 
21
21
  it "separates escaping from the end of words" do
22
- ThinkingSphinx::Wildcard.call("\\(913\\)").should == "\\(*913*\\)"
22
+ expect(ThinkingSphinx::Wildcard.call("\\(913\\)")).to eq("\\(*913*\\)")
23
23
  end
24
24
 
25
25
  it "ignores escaped slashes" do
26
- ThinkingSphinx::Wildcard.call("\\/\\/pan").should == "\\/\\/*pan*"
26
+ expect(ThinkingSphinx::Wildcard.call("\\/\\/pan")).to eq("\\/\\/*pan*")
27
27
  end
28
28
 
29
29
  it "does not star manually provided field tags" do
30
- ThinkingSphinx::Wildcard.call("@title pan").should == "@title *pan*"
30
+ expect(ThinkingSphinx::Wildcard.call("@title pan")).to eq("@title *pan*")
31
+ end
32
+
33
+ it 'does not star multiple field tags' do
34
+ expect(ThinkingSphinx::Wildcard.call("@title pan @tags food")).
35
+ to eq("@title *pan* @tags *food*")
31
36
  end
32
37
 
33
38
  it "does not star manually provided arrays of field tags" do
34
- ThinkingSphinx::Wildcard.call("@(title, body) pan").
35
- should == "@(title, body) *pan*"
39
+ expect(ThinkingSphinx::Wildcard.call("@(title, body) pan")).
40
+ to eq("@(title, body) *pan*")
36
41
  end
37
42
 
38
43
  it "handles nil queries" do
39
- ThinkingSphinx::Wildcard.call(nil).should == ''
44
+ expect(ThinkingSphinx::Wildcard.call(nil)).to eq('')
40
45
  end
41
46
 
42
47
  it "handles unicode values" do
43
- ThinkingSphinx::Wildcard.call('älytön').should == '*älytön*'
48
+ expect(ThinkingSphinx::Wildcard.call('älytön')).to eq('*älytön*')
44
49
  end
45
50
  end
46
51
  end
@@ -6,15 +6,15 @@ describe ThinkingSphinx do
6
6
  :options => {}) }
7
7
 
8
8
  before :each do
9
- ThinkingSphinx::Search.stub :new => search
9
+ allow(ThinkingSphinx::Search).to receive_messages :new => search
10
10
  end
11
11
 
12
12
  it "returns the total entries of the search object" do
13
- ThinkingSphinx.count.should == search.total_entries
13
+ expect(ThinkingSphinx.count).to eq(search.total_entries)
14
14
  end
15
15
 
16
16
  it "passes through the given query and options" do
17
- ThinkingSphinx::Search.should_receive(:new).with('foo', :bar => :baz).
17
+ expect(ThinkingSphinx::Search).to receive(:new).with('foo', :bar => :baz).
18
18
  and_return(search)
19
19
 
20
20
  ThinkingSphinx.count('foo', :bar => :baz)
@@ -25,15 +25,15 @@ describe ThinkingSphinx do
25
25
  let(:search) { double('search') }
26
26
 
27
27
  before :each do
28
- ThinkingSphinx::Search.stub :new => search
28
+ allow(ThinkingSphinx::Search).to receive_messages :new => search
29
29
  end
30
30
 
31
31
  it "returns a new search object" do
32
- ThinkingSphinx.search.should == search
32
+ expect(ThinkingSphinx.search).to eq(search)
33
33
  end
34
34
 
35
35
  it "passes through the given query and options" do
36
- ThinkingSphinx::Search.should_receive(:new).with('foo', :bar => :baz).
36
+ expect(ThinkingSphinx::Search).to receive(:new).with('foo', :bar => :baz).
37
37
  and_return(search)
38
38
 
39
39
  ThinkingSphinx.search('foo', :bar => :baz)
@@ -3,7 +3,7 @@ $:.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.2.0'
6
+ s.version = '3.3.0'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Pat Allan"]
9
9
  s.email = ["pat@freelancing-gods.com"]
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'joiner', '>= 0.2.0'
27
27
  s.add_runtime_dependency 'middleware', '>= 0.1.0'
28
28
  s.add_runtime_dependency 'innertube', '>= 1.0.2'
29
- s.add_runtime_dependency 'riddle', '>= 1.5.11'
29
+ s.add_runtime_dependency 'riddle', '>= 2.0.0'
30
30
 
31
31
  s.add_development_dependency 'appraisal', '~> 1.0.2'
32
- s.add_development_dependency 'combustion', '~> 0.4.0'
32
+ s.add_development_dependency 'combustion', '~> 0.5.4'
33
33
  s.add_development_dependency 'database_cleaner', '~> 1.2.0'
34
- s.add_development_dependency 'rspec', '~> 2.13.0'
34
+ s.add_development_dependency 'rspec', '~> 3.5.0'
35
35
  end
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.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.5.11
89
+ version: 2.0.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.5.11
96
+ version: 2.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: appraisal
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.4.0
117
+ version: 0.5.4
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.4.0
124
+ version: 0.5.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: database_cleaner
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 2.13.0
145
+ version: 3.5.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.13.0
152
+ version: 3.5.0
153
153
  description: An intelligent layer for ActiveRecord (via Rails and Sinatra) for the
154
154
  Sphinx full-text search tool.
155
155
  email:
@@ -171,6 +171,7 @@ files:
171
171
  - gemfiles/rails_4_0.gemfile
172
172
  - gemfiles/rails_4_1.gemfile
173
173
  - gemfiles/rails_4_2.gemfile
174
+ - gemfiles/rails_5_0.gemfile
174
175
  - lib/thinking-sphinx.rb
175
176
  - lib/thinking/sphinx.rb
176
177
  - lib/thinking_sphinx.rb
@@ -308,6 +309,7 @@ files:
308
309
  - spec/acceptance/attribute_updates_spec.rb
309
310
  - spec/acceptance/batch_searching_spec.rb
310
311
  - spec/acceptance/big_integers_spec.rb
312
+ - spec/acceptance/connection_spec.rb
311
313
  - spec/acceptance/excerpts_spec.rb
312
314
  - spec/acceptance/facets_spec.rb
313
315
  - spec/acceptance/geosearching_spec.rb
@@ -450,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
452
  version: '0'
451
453
  requirements: []
452
454
  rubyforge_project: thinking-sphinx
453
- rubygems_version: 2.4.8
455
+ rubygems_version: 2.5.1
454
456
  signing_key:
455
457
  specification_version: 4
456
458
  summary: A smart wrapper over Sphinx for ActiveRecord
@@ -460,6 +462,7 @@ test_files:
460
462
  - spec/acceptance/attribute_updates_spec.rb
461
463
  - spec/acceptance/batch_searching_spec.rb
462
464
  - spec/acceptance/big_integers_spec.rb
465
+ - spec/acceptance/connection_spec.rb
463
466
  - spec/acceptance/excerpts_spec.rb
464
467
  - spec/acceptance/facets_spec.rb
465
468
  - spec/acceptance/geosearching_spec.rb