thinking-sphinx 4.4.1 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +218 -0
  3. data/.travis.yml +12 -21
  4. data/Appraisals +16 -19
  5. data/CHANGELOG.markdown +93 -0
  6. data/README.textile +17 -17
  7. data/bin/loadsphinx +22 -4
  8. data/lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb +1 -1
  9. data/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb +1 -1
  10. data/lib/thinking_sphinx/active_record/base.rb +2 -6
  11. data/lib/thinking_sphinx/active_record/callbacks/association_delta_callbacks.rb +21 -0
  12. data/lib/thinking_sphinx/active_record/callbacks/delete_callbacks.rb +6 -2
  13. data/lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb +3 -2
  14. data/lib/thinking_sphinx/active_record/callbacks/update_callbacks.rb +1 -1
  15. data/lib/thinking_sphinx/active_record/interpreter.rb +4 -4
  16. data/lib/thinking_sphinx/active_record/sql_source/template.rb +2 -2
  17. data/lib/thinking_sphinx/active_record/sql_source.rb +12 -0
  18. data/lib/thinking_sphinx/active_record.rb +3 -0
  19. data/lib/thinking_sphinx/callbacks/appender.rb +63 -0
  20. data/lib/thinking_sphinx/callbacks.rb +9 -0
  21. data/lib/thinking_sphinx/connection/client.rb +6 -1
  22. data/lib/thinking_sphinx/connection.rb +4 -0
  23. data/lib/thinking_sphinx/core/index.rb +1 -2
  24. data/lib/thinking_sphinx/deletion.rb +18 -17
  25. data/lib/thinking_sphinx/errors.rb +1 -1
  26. data/lib/thinking_sphinx/index_set.rb +7 -3
  27. data/lib/thinking_sphinx/middlewares/sphinxql.rb +1 -1
  28. data/lib/thinking_sphinx/railtie.rb +20 -7
  29. data/lib/thinking_sphinx/real_time/index/template.rb +12 -0
  30. data/lib/thinking_sphinx/real_time/index.rb +5 -3
  31. data/lib/thinking_sphinx/real_time/interpreter.rb +8 -6
  32. data/lib/thinking_sphinx/real_time/populator.rb +4 -1
  33. data/lib/thinking_sphinx/real_time/transcriber.rb +41 -19
  34. data/lib/thinking_sphinx/real_time/translator.rb +1 -0
  35. data/lib/thinking_sphinx/search/stale_ids_exception.rb +2 -1
  36. data/lib/thinking_sphinx/search.rb +1 -1
  37. data/lib/thinking_sphinx/settings.rb +13 -9
  38. data/lib/thinking_sphinx/sinatra.rb +1 -1
  39. data/lib/thinking_sphinx/test.rb +1 -1
  40. data/lib/thinking_sphinx.rb +0 -3
  41. data/spec/acceptance/attribute_access_spec.rb +10 -2
  42. data/spec/acceptance/big_integers_spec.rb +1 -1
  43. data/spec/acceptance/geosearching_spec.rb +13 -3
  44. data/spec/acceptance/merging_spec.rb +1 -1
  45. data/spec/acceptance/paginating_search_results_spec.rb +18 -2
  46. data/spec/acceptance/real_time_updates_spec.rb +2 -2
  47. data/spec/acceptance/searching_with_filters_spec.rb +3 -3
  48. data/spec/acceptance/sql_deltas_spec.rb +16 -4
  49. data/spec/acceptance/support/sphinx_controller.rb +6 -4
  50. data/spec/acceptance/support/sphinx_helpers.rb +4 -4
  51. data/spec/acceptance/suspended_deltas_spec.rb +3 -3
  52. data/spec/internal/app/indices/article_index.rb +0 -1
  53. data/spec/internal/app/indices/colour_index.rb +7 -0
  54. data/spec/internal/app/models/admin/person.rb +3 -1
  55. data/spec/internal/app/models/album.rb +3 -1
  56. data/spec/internal/app/models/animal.rb +1 -0
  57. data/spec/internal/app/models/article.rb +2 -0
  58. data/spec/internal/app/models/bird.rb +1 -0
  59. data/spec/internal/app/models/book.rb +2 -0
  60. data/spec/internal/app/models/car.rb +1 -1
  61. data/spec/internal/app/models/city.rb +2 -0
  62. data/spec/internal/app/models/colour.rb +2 -0
  63. data/spec/internal/app/models/product.rb +1 -1
  64. data/spec/internal/app/models/tee.rb +5 -0
  65. data/spec/internal/app/models/user.rb +2 -0
  66. data/spec/internal/config/database.yml +6 -1
  67. data/spec/internal/db/schema.rb +1 -0
  68. data/spec/thinking_sphinx/active_record/callbacks/update_callbacks_spec.rb +2 -1
  69. data/spec/thinking_sphinx/active_record/index_spec.rb +3 -13
  70. data/spec/thinking_sphinx/active_record/interpreter_spec.rb +15 -14
  71. data/spec/thinking_sphinx/active_record/sql_source_spec.rb +41 -3
  72. data/spec/thinking_sphinx/connection/mri_spec.rb +49 -0
  73. data/spec/thinking_sphinx/deletion_spec.rb +5 -4
  74. data/spec/thinking_sphinx/index_set_spec.rb +28 -12
  75. data/spec/thinking_sphinx/middlewares/sphinxql_spec.rb +2 -1
  76. data/spec/thinking_sphinx/real_time/index_spec.rb +51 -13
  77. data/spec/thinking_sphinx/real_time/interpreter_spec.rb +14 -14
  78. data/spec/thinking_sphinx/real_time/transcriber_spec.rb +9 -1
  79. data/thinking-sphinx.gemspec +3 -3
  80. metadata +17 -12
  81. data/spec/acceptance/connection_spec.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8afa50f4e183cba6d6ce4776b66ab3f274dd538af0ae98e1afd2d73132bc73d
4
- data.tar.gz: b4a17507c4f023936ff6dabf1c8d4ae9cff2e08ba94808299ae7d7e9edc6c38d
3
+ metadata.gz: 4829363e45789cd8824b01645737455277dff8ce8d3ab4dd7ea9cd6bd748179b
4
+ data.tar.gz: c605d34504bef55fcb03d92d42e86348296689697df8fc0cd0fc2fb36ac7f097
5
5
  SHA512:
6
- metadata.gz: 0cac814c511fc65b6bd477ff5b7861bedc551394d53655c75294d834bdc48ae6fa5b361e5e6b3e7a76c4280bc737c65188f21ed72abf18e352a55d967c354249
7
- data.tar.gz: d79216c06faaa641ea71a30234ad6923fbbb9f2c0b5b0a75a2f7ce62720e6cbf91233965f6d2b0c7133e6e63c81c89db59306c3eb13da194c51fc009bf124041
6
+ metadata.gz: 2e768c63a2df5057432a0e28ab5fdb335cd28cf47fe3f2ac115e34eb7c10b4abe62721543c36ffe29aeaca013434fb069262b9fda5d752b2396f2df43d0d1c17
7
+ data.tar.gz: 5ab46830963db408b4789b5c3a694cd13b6c0cece4be23b23e68e589d4e54561c1c597ffa2b579324fa3e825a335cc611ecde17cc9d4e13f0117f6cd31a6b4fc
@@ -0,0 +1,218 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ ruby: circleci/ruby@1.0
5
+
6
+ workflows:
7
+ test:
8
+ jobs:
9
+ - test:
10
+ name: "Sphinx 2.2"
11
+ sphinx_version: 2.2.11
12
+ sphinx_engine: sphinx
13
+ debian: jessie
14
+ ruby: '2.4.6'
15
+ matrix:
16
+ parameters:
17
+ database: [ 'mysql2', 'postgresql' ]
18
+ rails: [ '4_2', '5_0', '5_1', '5_2' ]
19
+ - test:
20
+ name: "Sphinx 3.4"
21
+ sphinx_version: 3.4.1
22
+ sphinx_engine: sphinx
23
+ debian: buster
24
+ matrix:
25
+ parameters:
26
+ database: [ 'mysql2' ]
27
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
28
+ rails: [ '4_2', '5_0', '5_1', '5_2' ]
29
+ exclude:
30
+ - rails: '4_2'
31
+ ruby: '2.5.9'
32
+ - rails: '4_2'
33
+ ruby: '2.6.9'
34
+ - rails: '4_2'
35
+ ruby: '2.7.5'
36
+ - rails: '4_2'
37
+ ruby: '3.0.3'
38
+ - rails: '5_0'
39
+ ruby: '3.0.3'
40
+ - rails: '5_1'
41
+ ruby: '3.0.3'
42
+ - rails: '5_2'
43
+ ruby: '3.0.3'
44
+ - rails: '6_0'
45
+ ruby: '2.4.10'
46
+ - rails: '6_1'
47
+ ruby: '2.4.10'
48
+ - rails: '7_0'
49
+ ruby: '2.4.10'
50
+ - rails: '7_0'
51
+ ruby: '2.5.9'
52
+ - rails: '7_0'
53
+ ruby: '2.6.9'
54
+ - test:
55
+ name: "Manticore 3.5"
56
+ sphinx_version: 3.5.4
57
+ sphinx_engine: manticore
58
+ debian: buster
59
+ matrix:
60
+ parameters:
61
+ database: [ 'mysql2', 'postgresql' ]
62
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
63
+ rails: [ '4_2', '5_0', '5_1', '5_2' ]
64
+ exclude:
65
+ - rails: '4_2'
66
+ ruby: '2.5.9'
67
+ - rails: '4_2'
68
+ ruby: '2.6.9'
69
+ - rails: '4_2'
70
+ ruby: '2.7.5'
71
+ - rails: '4_2'
72
+ ruby: '3.0.3'
73
+ - rails: '5_0'
74
+ ruby: '3.0.3'
75
+ - rails: '5_1'
76
+ ruby: '3.0.3'
77
+ - rails: '5_2'
78
+ ruby: '3.0.3'
79
+ - rails: '6_0'
80
+ ruby: '2.4.10'
81
+ - rails: '6_1'
82
+ ruby: '2.4.10'
83
+ - rails: '7_0'
84
+ ruby: '2.4.10'
85
+ - rails: '7_0'
86
+ ruby: '2.5.9'
87
+ - rails: '7_0'
88
+ ruby: '2.6.9'
89
+ - test:
90
+ name: "Manticore 4.0"
91
+ sphinx_version: 4.0.2
92
+ sphinx_engine: manticore
93
+ debian: buster
94
+ matrix:
95
+ parameters:
96
+ database: [ 'mysql2', 'postgresql' ]
97
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
98
+ rails: [ '4_2', '5_0', '5_1', '5_2' ]
99
+ exclude:
100
+ - rails: '4_2'
101
+ ruby: '2.5.9'
102
+ - rails: '4_2'
103
+ ruby: '2.6.9'
104
+ - rails: '4_2'
105
+ ruby: '2.7.5'
106
+ - rails: '4_2'
107
+ ruby: '3.0.3'
108
+ - rails: '5_0'
109
+ ruby: '3.0.3'
110
+ - rails: '5_1'
111
+ ruby: '3.0.3'
112
+ - rails: '5_2'
113
+ ruby: '3.0.3'
114
+ - rails: '6_0'
115
+ ruby: '2.4.10'
116
+ - rails: '6_1'
117
+ ruby: '2.4.10'
118
+ - rails: '7_0'
119
+ ruby: '2.4.10'
120
+ - rails: '7_0'
121
+ ruby: '2.5.9'
122
+ - rails: '7_0'
123
+ ruby: '2.6.9'
124
+
125
+ jobs:
126
+ test:
127
+ parameters:
128
+ ruby:
129
+ type: string
130
+ rails:
131
+ type: string
132
+ database:
133
+ type: string
134
+ sphinx_version:
135
+ type: string
136
+ sphinx_engine:
137
+ type: string
138
+ debian:
139
+ type: string
140
+
141
+ docker:
142
+ - image: circleci/ruby:<< parameters.ruby >>-<< parameters.debian >>
143
+
144
+ - image: circleci/postgres:10
145
+ environment:
146
+ POSTGRES_USER: postgres
147
+ POSTGRES_PASSWORD: thinking_sphinx
148
+ POSTGRES_DB: thinking_sphinx
149
+
150
+ - image: circleci/mysql:5.7
151
+ environment:
152
+ MYSQL_ROOT_PASSWORD: thinking_sphinx
153
+ MYSQL_DATABASE: thinking_sphinx
154
+
155
+ working_directory: ~/app
156
+
157
+ steps:
158
+ - checkout
159
+
160
+ - restore_cache:
161
+ keys:
162
+ - v1-dependencies-<< parameters.ruby >>-<< parameters.rails >>
163
+
164
+ - run:
165
+ name: install bundler
166
+ command: |
167
+ if [ "<< parameters.ruby >>" == "2.7.5" ]; then
168
+ export BUNDLER_VERSION=2.1.4
169
+ elif [ "<< parameters.ruby >>" == "3.0.3" ]; then
170
+ export BUNDLER_VERSION=2.1.4
171
+ else
172
+ export BUNDLER_VERSION=1.17.3
173
+ fi
174
+ export BUNDLE_PATH=vendor/bundle
175
+ gem install bundler:$BUNDLER_VERSION
176
+
177
+ - run:
178
+ name: install dependencies
179
+ command: |
180
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
181
+ bundle update
182
+
183
+ - run:
184
+ name: set up appraisal
185
+ command: bundle exec appraisal generate
186
+
187
+ - run:
188
+ name: update gems
189
+ environment:
190
+ BUNDLE_GEMFILE: "./gemfiles/rails_<< parameters.rails >>.gemfile"
191
+ command: |
192
+ if [[ -f $BUNDLE_GEMFILE ]]
193
+ then
194
+ bundle update
195
+ fi
196
+
197
+ - save_cache:
198
+ paths:
199
+ - ./vendor/bundle
200
+ key: v1-dependencies-<< parameters.ruby >>-<< parameters.rails >>
201
+
202
+ - run:
203
+ name: set up sphinx
204
+ command: "./bin/loadsphinx << parameters.sphinx_version >> << parameters.sphinx_engine >>"
205
+
206
+ - run:
207
+ name: tests
208
+ environment:
209
+ CI: "true"
210
+ DATABASE: << parameters.database >>
211
+ SPHINX_VERSION: << parameters.sphinx_version >>
212
+ SPHINX_ENGINE: << parameters.sphinx_engine >>
213
+ BUNDLE_GEMFILE: "./gemfiles/rails_<< parameters.rails >>.gemfile"
214
+ command: |
215
+ if [[ -f $BUNDLE_GEMFILE ]]
216
+ then
217
+ bundle exec rspec
218
+ fi
data/.travis.yml CHANGED
@@ -1,39 +1,30 @@
1
1
  language: ruby
2
2
  dist: xenial
3
3
  rvm:
4
- - 2.3.8
5
- - 2.4.6
6
- - 2.5.5
7
- - 2.6.3
4
+ - 2.4.10
5
+ - 2.5.8
6
+ - 2.6.6
7
+ - 2.7.1
8
8
  before_install:
9
- - pip install --upgrade --user awscli
10
9
  - gem update --system
11
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
12
- - gem install bundler -v '< 2'
10
+ - gem install bundler -v '1.17.3'
11
+ install: bundle _1.17.3_ install --jobs=3 --retry=3
13
12
  before_script:
14
13
  - mysql -e 'create database thinking_sphinx;' > /dev/null
15
14
  - psql -c 'create database thinking_sphinx;' -U postgres >/dev/null
16
15
  - "./bin/loadsphinx $SPHINX_VERSION $SPHINX_ENGINE"
17
- - bundle exec appraisal install
18
- script: bundle exec appraisal rspec
16
+ - bundle _1.17.3_ exec appraisal install
17
+ script: bundle _1.17.3_ exec appraisal rspec
19
18
  env:
20
- global:
21
- - secure: cUPinkilBafqDSPsTkl/PXYc2aXNKUQKXGK8poBBMqKN9/wjfJx1DWgtowDKalekdZELxDhc85Ye3bL1xlW4nLjOu+U6Tkt8eNw2Nhs1flodHzA/RyENdBLr/tBHt43EjkrDehZx5sBHmWQY4miHs8AJz0oKO9Ae2inTOHx9Iuc=
22
19
  matrix:
23
- - DATABASE=mysql2 SPHINX_VERSION=2.1.9 SPHINX_ENGINE=sphinx
24
- - DATABASE=postgresql SPHINX_VERSION=2.1.9 SPHINX_ENGINE=sphinx
25
20
  - DATABASE=mysql2 SPHINX_VERSION=2.2.11 SPHINX_ENGINE=sphinx
26
21
  - DATABASE=postgresql SPHINX_VERSION=2.2.11 SPHINX_ENGINE=sphinx
27
- - DATABASE=mysql2 SPHINX_VERSION=3.0.3 SPHINX_ENGINE=sphinx
28
- - DATABASE=postgresql SPHINX_VERSION=3.0.3 SPHINX_ENGINE=sphinx
29
- - DATABASE=mysql2 SPHINX_VERSION=3.1.1 SPHINX_ENGINE=sphinx
30
- - DATABASE=mysql2 SPHINX_VERSION=2.6.4 SPHINX_ENGINE=manticore
31
- - DATABASE=postgresql SPHINX_VERSION=2.6.4 SPHINX_ENGINE=manticore
32
- - DATABASE=mysql2 SPHINX_VERSION=2.7.5 SPHINX_ENGINE=manticore
33
- - DATABASE=postgresql SPHINX_VERSION=2.7.5 SPHINX_ENGINE=manticore
22
+ - DATABASE=mysql2 SPHINX_VERSION=3.3.1 SPHINX_ENGINE=sphinx
34
23
  - DATABASE=mysql2 SPHINX_VERSION=2.8.2 SPHINX_ENGINE=manticore
35
24
  - DATABASE=postgresql SPHINX_VERSION=2.8.2 SPHINX_ENGINE=manticore
36
- # - DATABASE=postgresql SPHINX_VERSION=3.1.1 SPHINX_ENGINE=sphinx
25
+ - DATABASE=mysql2 SPHINX_VERSION=3.5.0 SPHINX_ENGINE=manticore
26
+ - DATABASE=postgresql SPHINX_VERSION=3.5.0 SPHINX_ENGINE=manticore
27
+ # - DATABASE=postgresql SPHINX_VERSION=3.3.1 SPHINX_ENGINE=sphinx
37
28
  sudo: false
38
29
  addons:
39
30
  postgresql: '9.4'
data/Appraisals CHANGED
@@ -1,22 +1,7 @@
1
- appraise 'rails_3_2' do
2
- gem 'rails', '~> 3.2.22.2'
3
- gem 'mysql2', '~> 0.3.10', :platform => :ruby
4
- end if RUBY_VERSION.to_f <= 2.3
5
-
6
- appraise 'rails_4_0' do
7
- gem 'rails', '~> 4.0.13'
8
- gem 'mysql2', '~> 0.3.10', :platform => :ruby
9
- end if RUBY_VERSION.to_f <= 2.3
10
-
11
- appraise 'rails_4_1' do
12
- gem 'rails', '~> 4.1.15'
13
- gem 'mysql2', '~> 0.3.13', :platform => :ruby
14
- end if RUBY_VERSION.to_f <= 2.3
15
-
16
1
  appraise 'rails_4_2' do
17
2
  gem 'rails', '~> 4.2.6'
18
3
  gem 'mysql2', '~> 0.4.0', :platform => :ruby
19
- end if RUBY_VERSION.to_f <= 2.3
4
+ end if RUBY_VERSION.to_f <= 2.4
20
5
 
21
6
  appraise 'rails_5_0' do
22
7
  if RUBY_PLATFORM == "java"
@@ -30,21 +15,33 @@ appraise 'rails_5_0' do
30
15
  gem 'jdbc-mysql', '~> 5.1.36', :platform => :jruby
31
16
  gem 'activerecord-jdbcmysql-adapter', '~> 50.0', :platform => :jruby
32
17
  gem 'activerecord-jdbcpostgresql-adapter', '~> 50.0', :platform => :jruby
33
- end if RUBY_PLATFORM != "java" || ENV["SPHINX_VERSION"].to_f > 2.1
18
+ end if (RUBY_PLATFORM != "java" || ENV["SPHINX_VERSION"].to_f > 2.1) && RUBY_VERSION.to_f < 3.0
34
19
 
35
20
  appraise 'rails_5_1' do
36
21
  gem 'rails', '~> 5.1.0'
37
22
  gem 'mysql2', '~> 0.4.0', :platform => :ruby
38
- end if RUBY_PLATFORM != 'java'
23
+ end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f < 3.0
39
24
 
40
25
  appraise 'rails_5_2' do
41
26
  gem 'rails', '~> 5.2.0'
42
27
  gem 'mysql2', '~> 0.5.0', :platform => :ruby
43
28
  gem 'pg', '~> 1.0', :platform => :ruby
44
- end if RUBY_PLATFORM != 'java'
29
+ end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f < 3.0
45
30
 
46
31
  appraise 'rails_6_0' do
47
32
  gem 'rails', '~> 6.0.0'
48
33
  gem 'mysql2', '~> 0.5.0', :platform => :ruby
49
34
  gem 'pg', '~> 1.0', :platform => :ruby
50
35
  end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f >= 2.5
36
+
37
+ appraise 'rails_6_1' do
38
+ gem 'rails', '~> 6.1.0'
39
+ gem 'mysql2', '~> 0.5.0', :platform => :ruby
40
+ gem 'pg', '~> 1.0', :platform => :ruby
41
+ end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f >= 2.5
42
+
43
+ appraise 'rails_7_0' do
44
+ gem 'rails', '~> 7.0.0'
45
+ gem 'mysql2', '~> 0.5.0', :platform => :ruby
46
+ gem 'pg', '~> 1.0', :platform => :ruby
47
+ end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f >= 2.7
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,99 @@
2
2
 
3
3
  All notable changes to this project (at least, from v3.0.0 onwards) are documented in this file.
4
4
 
5
+ ## 5.4.0 - 2021-12-21
6
+
7
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.4.0)
8
+
9
+ ### Added
10
+
11
+ * Rails 7 support, including contributions from @anthonyshull in [#1205](https://github.com/pat/thinking-sphinx/pull/1205).
12
+
13
+ ### Changed
14
+
15
+ * Confirmed support by testing against Manticore 4.0 and Sphinx 3.4.
16
+
17
+ ### Fixed
18
+
19
+ * Include instance_exec in ThinkingSphinx::Search::CORE_METHODS by @jdelStrother in [#1210](https://github.com/pat/thinking-sphinx/pull/1210).
20
+ * Use File.exist? instead of the deprecated File.exists? ([#1211](https://github.com/pat/thinking-sphinx/issues/1211)).
21
+
22
+ ## 5.3.0 - 2021-08-19
23
+
24
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.3.0)
25
+
26
+ ### Changed
27
+
28
+ * StaleIdsExceptions now include a URL in their error message with recommendations on how to resolve the problem.
29
+ * Fire real-time callbacks on `after_commit` (including deletions) to ensure data is fully persisted to the database before updating Sphinx. More details in [#1204](https://github.com/pat/thinking-sphinx/pull/1204).
30
+
31
+ ### Fixed
32
+
33
+ * Ensure Thinking Sphinx's ActiveRecord components are loaded by either Rails' after_initialise hook or ActiveSupport's on_load notification, because the order of these two events are not consistent.
34
+ * Remove `app/indices` from eager_load_paths in Rails 4.2 and 5, to match the behaviour in 6.
35
+
36
+ ## 5.2.1 - 2021-08-09
37
+
38
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.2.1)
39
+
40
+ ### Fixed
41
+
42
+ * Ensure ActiveRecord components are loaded for rake tasks, but only after the Rails application has initialised. More details in [#1199](https://github.com/pat/thinking-sphinx/issues/1199).
43
+
44
+ ## 5.2.0 - 2021-06-12
45
+
46
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.2.0)
47
+
48
+ ### Added
49
+
50
+ * Confirmed support for Ruby 3.0.
51
+ * Orphaned records in real-time indices can now be cleaned up without running `rails ts:rebuild`. Disabled by default, can be enabled by setting `real_time_tidy` to true per environment in `config/thinking_sphinx.yml` (and will need `ts:rebuild` to restructure indices upon initial deploy). More details in [#1192](https://github.com/pat/thinking-sphinx/pull/1192).
52
+
53
+ ### Fixed
54
+
55
+ * Avoid loading ActiveRecord during Rails initialisation so app configuration can still have an impact ([@jdelStrother](https://github.com/jdelStrother) in [#1194](https://github.com/pat/thinking-sphinx/pull/1194)).
56
+ * Remove `app/indices` (in both the Rails app and engines) from Rails' eager load paths, which was otherwise leading to indices being loaded more than once. (See [#1191](https://github.com/pat/thinking-sphinx/issues/1191) and [#1195](https://github.com/pat/thinking-sphinx/issues/1195)).
57
+
58
+ ## 5.1.0 - 2020-12-28
59
+
60
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.1.0)
61
+
62
+ ### Added
63
+
64
+ * Support for Sphinx v3.3 and Manticore v3.5.
65
+ * Support for Rails 6.1 (via [joiner](https://rubygems.org/gems/joiner) v0.6.0).
66
+
67
+ ### Changed
68
+
69
+ * `enable_star` is no longer available as a configuration option, as it's been enabled by default in Sphinx since v2.2.2, and is no longer allowed in Sphinx v3.3.1.
70
+ * All timestamp attributes are now considered plain integer values from Sphinx's perspective. Sphinx was already expecting integers, but since Sphinx v3.3.1 it doesn't recognise timestamps as a data type. There is no functional difference with this change - Thinking Sphinx was always converting times to their UNIX epoch integer values.
71
+ * Allow configuration of the maximum statement length ([@kalsan](https://github.com/kalsan) in [#1179](https://github.com/pat/thinking-sphinx/pull/1179)).
72
+ * Respect `:path` values to navigate associations for Thinking Sphinx callbacks on SQL-backed indices. Discussed in [#1182](https://github.com/pat/thinking-sphinx/issues/1182).
73
+
74
+ ### Fixed
75
+
76
+ * Don't attempt to update delta flags on frozen model instances.
77
+
78
+ ## 5.0.0 - 2020-07-20
79
+
80
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.0.0)
81
+
82
+ ### Added
83
+
84
+ * New interface for adding callbacks to indexed models (which is no longer done automatically). Discussed in [#1173](https://github.com/pat/thinking-sphinx/issues/1173) and committed via [#1175](https://github.com/pat/thinking-sphinx/pull/1175). **This is a breaking change - you will need to add these callbacks. See [the full release notes](https://github.com/pat/thinking-sphinx/releases/tag/v5.0.0) for examples.**
85
+ * Fields and attributes can be overriden - whichever's defined last with a given name is the definition that's used. This is an edge case, but useful if you want to override any of the default fields/indices. (Requested by @kalsan in [#1172](https://github.com/pat/thinking-sphinx/issues/1172).)
86
+ * Custom index_set_class implementations can now expect the `:instances` option to be set alongside `:classes`, which is useful in cases to limit the indices returned if you're splitting index data for given classes/models into shards. (Introduced in PR [#1171](https://github.com/pat/thinking-sphinx/pull/1171) after discussions with @lunaru in [#1166](https://github.com/pat/thinking-sphinx/issues/1166).)
87
+
88
+ ### Changed
89
+
90
+ * Sphinx 2.2.11 or newer is required, or Manticore 2.8.2 or newer.
91
+ * Ruby 2.4 or newer is required.
92
+ * Rails 4.2 or newer is required.
93
+ * Remove internal uses of `send`, replaced with `public_send` as that's available in all supported Ruby versions.
94
+ * Deletion statements are simplified by avoiding the need to calculate document keys/offsets (@njakobsen via [#1134](https://github.com/pat/thinking-sphinx/issues/1134)).
95
+ * Real-time data is deleted before replacing it, to avoid duplicate data when offsets change (@njakobsen via [#1134](https://github.com/pat/thinking-sphinx/issues/1134)).
96
+ * Use `reference_name` as per custom `index_set_class` definitions. Previously, the class method was called on `ThinkingSphinx::IndexSet` even if a custom subclass was configured. (As per discussions with @kalsan in [#1172](https://github.com/pat/thinking-sphinx/issues/1172).)
97
+
5
98
  ## 4.4.1 - 2019-08-23
6
99
 
7
100
  [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.4.1)
data/README.textile CHANGED
@@ -1,22 +1,22 @@
1
1
  h1. Thinking Sphinx
2
2
 
3
- Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v4.4.1.
3
+ Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v5.4.0.
4
4
 
5
5
  h2. Upgrading
6
6
 
7
7
  Please refer to "the changelog":https://github.com/pat/thinking-sphinx/blob/develop/CHANGELOG.markdown and "release notes":https://github.com/pat/thinking-sphinx/releases for any changes you need to make when upgrading. The release notes in particular are quite good at covering breaking changes and more details for new features.
8
8
 
9
- The documentation also has more details on what's involved for upgrading from "v3 to v4":https://freelancing-gods.com/thinking-sphinx/v4/upgrading.html, and "v1/v2 to v3":https://freelancing-gods.com/thinking-sphinx/v3/upgrading.html.
9
+ The documentation also has more details on what's involved for upgrading from "v4 to v5":https://freelancing-gods.com/thinking-sphinx/v5/upgrading.html, "v3 to v4":https://freelancing-gods.com/thinking-sphinx/v4/upgrading.html, and "v1/v2 to v3":https://freelancing-gods.com/thinking-sphinx/v3/upgrading.html.
10
10
 
11
11
  h2. Installation
12
12
 
13
13
  It's a gem, so install it like you would any other gem. You will also need to specify the mysql2 gem if you're using MRI, or jdbc-mysql if you're using JRuby:
14
14
 
15
- <pre><code>gem 'mysql2', '~> 0.3', :platform => :ruby
15
+ <pre><code>gem 'mysql2', '~> 0.4', :platform => :ruby
16
16
  gem 'jdbc-mysql', '~> 5.1.35', :platform => :jruby
17
- gem 'thinking-sphinx', '~> 4.4'</code></pre>
17
+ gem 'thinking-sphinx', '~> 5.4'</code></pre>
18
18
 
19
- The MySQL gems mentioned are required for connecting to Sphinx, so please include it even when you're using PostgreSQL for your database. If you're using JRuby with a version of Sphinx prior to 2.2.11, there is "currently an issue with Sphinx and jdbc-mysql 5.1.36 or newer":http://sphinxsearch.com/forum/view.html?id=13939, so you'll need to stick to nothing more recent than 5.1.35, or upgrade Sphinx.
19
+ The MySQL gems mentioned are required for connecting to Sphinx, so please include it even when you're using PostgreSQL for your database.
20
20
 
21
21
  You'll also need to install Sphinx - this is covered in "the extended documentation":https://freelancing-gods.com/thinking-sphinx/installing_sphinx.html.
22
22
 
@@ -29,30 +29,30 @@ h2. Requirements
29
29
  The current release of Thinking Sphinx works with the following versions of its dependencies:
30
30
 
31
31
  |_. Library |_. Minimum |_. Tested Against |
32
- | Ruby | v2.3 | v2.3.8, v2.4.5, v2.5.3, v2.6.1 |
33
- | Sphinx | v2.1.2 | v2.1.9, v2.2.11, v3.0.3, v3.1.1 |
34
- | Manticore | v2.6.3 | v2.6.4, v2.7.5, v2.8.1 |
35
- | ActiveRecord | v3.2 | v3.2..v6.0 |
32
+ | Ruby | v2.4 | v2.4, v2.5, v2.6, v2.7, v3.0 |
33
+ | Sphinx | v2.2.11 | v2.2.11, v3.3.1 |
34
+ | Manticore | v2.8 | v3.5, v4.0 |
35
+ | ActiveRecord | v4.2 | v4.2..v7.0 |
36
36
 
37
37
  It _might_ work with older versions of Ruby, but it's highly recommended to update to a supported release.
38
38
 
39
- It should also work with JRuby, but the test environment on Travis CI has been timing out, hence that's not actively tested against at the moment.
39
+ It should also work with JRuby, but the test environment for that in CI has been unreliable, hence that's not actively tested against at the moment.
40
40
 
41
41
  h3. Sphinx or Manticore
42
42
 
43
- Thinking Sphinx v3 is currently built for Sphinx 2.1.2 or newer, or Manticore v2.6+.
43
+ If you're using Sphinx, v2.2.11 is recommended even though it's quite old, as it works well with PostgreSQL databases (but if you're using MySQL - or real-time indices - then v3.3.1 should also be fine).
44
44
 
45
- h3. Rails and ActiveRecord
45
+ If you're opting for Manticore instead, v2.8 or newer works, but v3 or newer is recommended as that's what is actively tested against.
46
46
 
47
- Currently Thinking Sphinx 3 is built to support Rails/ActiveRecord 3.2 or newer. If you're using Sinatra and ActiveRecord instead of Rails, that's fine - just make sure you add the @:require => 'thinking_sphinx/sinatra'@ option when listing @thinking-sphinx@ in your Gemfile.
47
+ h3. Rails and ActiveRecord
48
48
 
49
- Please note that if you're referring to polymorphic associations in your index definitions, you'll want to be using Rails/ActiveRecord 4.0 or newer. Supporting polymorphic associations and Rails/ActiveRecord 3.2 is problematic, and likely will not be addressed in the future.
49
+ Currently Thinking Sphinx is built to support Rails/ActiveRecord 4.2 or newer. If you're using Sinatra and ActiveRecord instead of Rails, that's fine - just make sure you add the @:require => 'thinking_sphinx/sinatra'@ option when listing @thinking-sphinx@ in your Gemfile.
50
50
 
51
- If you want ActiveRecord 3.1 support, then refer to the 3.0.x releases of Thinking Sphinx. Anything older than that, then you're stuck with Thinking Sphinx v2.x (for Rails/ActiveRecord 3.0) or v1.x (Rails 2.3). Please note that these older versions are no longer actively supported.
51
+ If you want ActiveRecord 3.2-4.1 support, then refer to the 4.x releases of Thinking Sphinx. Or, for ActiveRecord 3.1 support, then refer to the 3.0.x releases. Anything older than that, then you're stuck with Thinking Sphinx v2.x (for Rails/ActiveRecord 3.0) or v1.x (Rails 2.3). Please note that these older versions are no longer actively supported.
52
52
 
53
53
  h3. Ruby
54
54
 
55
- You'll need either the standard Ruby (v2.3 or newer) or JRuby (9.1 or newer).
55
+ You'll need either the standard Ruby (v2.4 or newer) or JRuby (9.1 or newer).
56
56
 
57
57
  h3. Database Versions
58
58
 
@@ -81,4 +81,4 @@ You can then run the unit tests with @rake spec:unit@, the acceptance tests with
81
81
 
82
82
  h2. Licence
83
83
 
84
- Copyright (c) 2007-2019, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/thinking-sphinx/contributors.
84
+ Copyright (c) 2007-2021, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/thinking-sphinx/contributors.
data/bin/loadsphinx CHANGED
@@ -14,7 +14,7 @@ load_sphinx () {
14
14
  format="deb"
15
15
  distro="trusty";;
16
16
  2.2.11)
17
- url="http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~xenial_amd64.deb"
17
+ url="http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~jessie_amd64.deb"
18
18
  format="deb";;
19
19
  3.0.3)
20
20
  url="http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64.tar.gz"
@@ -22,6 +22,15 @@ load_sphinx () {
22
22
  3.1.1)
23
23
  url="http://sphinxsearch.com/files/sphinx-3.1.1-612d99f-linux-amd64.tar.gz"
24
24
  format="gz";;
25
+ 3.2.1)
26
+ url="http://sphinxsearch.com/files/sphinx-3.2.1-f152e0b-linux-amd64.tar.gz"
27
+ format="gz";;
28
+ 3.3.1)
29
+ url="http://sphinxsearch.com/files/sphinx-3.3.1-b72d67b-linux-amd64.tar.gz"
30
+ format="gz";;
31
+ 3.4.1)
32
+ url="http://sphinxsearch.com/files/sphinx-3.4.1-efbcc65-linux-amd64.tar.gz"
33
+ format="gz";;
25
34
  *)
26
35
  echo "No Sphinx version $version available"
27
36
  exit 1;;
@@ -34,7 +43,9 @@ load_sphinx () {
34
43
 
35
44
  if [ "$format" == "deb" ]; then
36
45
  curl --location $url -o sphinx.deb
37
- sudo apt-get install ./sphinx.deb
46
+ sudo apt-get install libodbc1
47
+ sudo dpkg -i ./sphinx.deb
48
+ sudo apt-get install -f
38
49
  else
39
50
  curl $url -o sphinx.tar.gz
40
51
  tar -zxvf sphinx.tar.gz
@@ -51,14 +62,21 @@ load_manticore () {
51
62
  2.7.5)
52
63
  url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.7.5/manticore_2.7.5-181204-4a31c54-release-stemmer.xenial_amd64-bin.deb";;
53
64
  2.8.2)
54
- url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.8.2/manticore_2.8.2-190402-4e81114-release-stemmer.xenial_amd64-bin.deb";;
65
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.8.2/manticore_2.8.2-190402-4e81114d-release-stemmer.stretch_amd64-bin.deb";;
66
+ 3.4.2)
67
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/3.4.2/manticore_3.4.2-200410-6903305-release.xenial_amd64-bin.deb";;
68
+ 3.5.4)
69
+ url="https://repo.manticoresearch.com/repository/manticoresearch_buster/pool/m/manticore/manticore_3.5.4-201211-13f8d08d_amd64.deb";;
70
+ 4.0.2)
71
+ url="https://repo.manticoresearch.com/repository/manticoresearch_buster/pool/m/manticore/manticore_4.0.2-210921-af497f245_amd64.deb";;
55
72
  *)
56
73
  echo "No Manticore version $version available"
57
74
  exit 1;;
58
75
  esac
59
76
 
60
77
  curl --location $url -o manticore.deb
61
- sudo apt-get install ./manticore.deb
78
+ sudo dpkg -i ./manticore.deb
79
+ sudo apt-get install -f
62
80
  }
63
81
 
64
82
  if [ "$engine" == "sphinx" ]; then
@@ -31,7 +31,7 @@ class ThinkingSphinx::ActiveRecord::AssociationProxy::AttributeFinder
31
31
  @indices ||= begin
32
32
  configuration.preload_indices
33
33
  configuration.indices_for_references(
34
- *ThinkingSphinx::IndexSet.reference_name(@association.klass)
34
+ *configuration.index_set_class.reference_name(@association.klass)
35
35
  ).reject &:distributed?
36
36
  end
37
37
  end
@@ -4,7 +4,7 @@ class ThinkingSphinx::ActiveRecord::Attribute::SphinxPresenter
4
4
  SPHINX_TYPES = {
5
5
  :integer => :uint,
6
6
  :boolean => :bool,
7
- :timestamp => :timestamp,
7
+ :timestamp => :uint,
8
8
  :float => :float,
9
9
  :string => :string,
10
10
  :bigint => :bigint,
@@ -4,11 +4,6 @@ module ThinkingSphinx::ActiveRecord::Base
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- after_destroy ThinkingSphinx::ActiveRecord::Callbacks::DeleteCallbacks
8
- before_save ThinkingSphinx::ActiveRecord::Callbacks::DeltaCallbacks
9
- after_update ThinkingSphinx::ActiveRecord::Callbacks::UpdateCallbacks
10
- after_commit ThinkingSphinx::ActiveRecord::Callbacks::DeltaCallbacks
11
-
12
7
  if ActiveRecord::VERSION::STRING.to_i >= 5
13
8
  [
14
9
  ::ActiveRecord::Reflection::HasManyReflection,
@@ -17,8 +12,9 @@ module ThinkingSphinx::ActiveRecord::Base
17
12
  reflection_class.include DefaultReflectionAssociations
18
13
  end
19
14
  else
20
- ::ActiveRecord::Associations::CollectionProxy.send :include,
15
+ ::ActiveRecord::Associations::CollectionProxy.include(
21
16
  ThinkingSphinx::ActiveRecord::AssociationProxy
17
+ )
22
18
  end
23
19
  end
24
20
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ThinkingSphinx::ActiveRecord::Callbacks::AssociationDeltaCallbacks
4
+ def initialize(path)
5
+ @path = path
6
+ end
7
+
8
+ def after_commit(instance)
9
+ Array(objects_for(instance)).each do |object|
10
+ object.update :delta => true unless object.frozen?
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :path
17
+
18
+ def objects_for(instance)
19
+ path.inject(instance) { |object, method| object.send method }
20
+ end
21
+ end