searchkick_bharthur 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +44 -0
- data/CHANGELOG.md +360 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +1443 -0
- data/Rakefile +8 -0
- data/lib/searchkick/index.rb +662 -0
- data/lib/searchkick/logging.rb +185 -0
- data/lib/searchkick/middleware.rb +12 -0
- data/lib/searchkick/model.rb +105 -0
- data/lib/searchkick/query.rb +845 -0
- data/lib/searchkick/reindex_job.rb +26 -0
- data/lib/searchkick/reindex_v2_job.rb +23 -0
- data/lib/searchkick/results.rb +211 -0
- data/lib/searchkick/tasks.rb +33 -0
- data/lib/searchkick/version.rb +3 -0
- data/lib/searchkick.rb +159 -0
- data/searchkick.gemspec +28 -0
- data/test/aggs_test.rb +115 -0
- data/test/autocomplete_test.rb +65 -0
- data/test/boost_test.rb +144 -0
- data/test/callbacks_test.rb +27 -0
- data/test/ci/before_install.sh +21 -0
- data/test/dangerous_reindex_test.rb +27 -0
- data/test/facets_test.rb +90 -0
- data/test/gemfiles/activerecord31.gemfile +7 -0
- data/test/gemfiles/activerecord32.gemfile +7 -0
- data/test/gemfiles/activerecord40.gemfile +8 -0
- data/test/gemfiles/activerecord41.gemfile +8 -0
- data/test/gemfiles/activerecord50.gemfile +7 -0
- data/test/gemfiles/apartment.gemfile +8 -0
- data/test/gemfiles/mongoid2.gemfile +7 -0
- data/test/gemfiles/mongoid3.gemfile +6 -0
- data/test/gemfiles/mongoid4.gemfile +7 -0
- data/test/gemfiles/mongoid5.gemfile +7 -0
- data/test/gemfiles/nobrainer.gemfile +6 -0
- data/test/highlight_test.rb +63 -0
- data/test/index_test.rb +120 -0
- data/test/inheritance_test.rb +78 -0
- data/test/match_test.rb +227 -0
- data/test/misspellings_test.rb +46 -0
- data/test/model_test.rb +42 -0
- data/test/multi_search_test.rb +22 -0
- data/test/multi_tenancy_test.rb +22 -0
- data/test/order_test.rb +44 -0
- data/test/pagination_test.rb +53 -0
- data/test/query_test.rb +13 -0
- data/test/records_test.rb +8 -0
- data/test/reindex_job_test.rb +31 -0
- data/test/reindex_v2_job_test.rb +32 -0
- data/test/routing_test.rb +13 -0
- data/test/should_index_test.rb +32 -0
- data/test/similar_test.rb +28 -0
- data/test/sql_test.rb +196 -0
- data/test/suggest_test.rb +80 -0
- data/test/synonyms_test.rb +54 -0
- data/test/test_helper.rb +361 -0
- data/test/where_test.rb +171 -0
- metadata +231 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 818186270af7ec5267bc549fc676bf129dadbb80
|
4
|
+
data.tar.gz: 102234acb915dc57f54cc654361ae760bed16092
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4a5cca2aa2830fa4112f2fa702b36930f0fc7fe3b060a9c3802033f0d5a4193eb8fb1de073440345c8d8dacfd76262cd6c5eacf5cefbb15b3904e0947fd20de0
|
7
|
+
data.tar.gz: 273108babbce1dd1f6e0696d09d3f9364c8dd749b8b6a94e7dc6ef0692708779386e968ba0a25a6094ae964650c174387bfbeeb1ee6d88ecf011f7d24dc9711f
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
*.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.log
|
19
|
+
.DS_Store
|
20
|
+
.ruby-*
|
21
|
+
.idea/
|
22
|
+
*.sqlite3
|
data/.travis.yml
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm: 2.2.5
|
3
|
+
services:
|
4
|
+
- elasticsearch
|
5
|
+
- mongodb
|
6
|
+
before_install:
|
7
|
+
- ./test/ci/before_install.sh
|
8
|
+
script: RUBYOPT=W0 bundle exec rake test
|
9
|
+
before_script:
|
10
|
+
- psql -c 'create database searchkick_test;' -U postgres
|
11
|
+
notifications:
|
12
|
+
email:
|
13
|
+
on_success: never
|
14
|
+
on_failure: change
|
15
|
+
gemfile:
|
16
|
+
- Gemfile
|
17
|
+
- test/gemfiles/activerecord50.gemfile
|
18
|
+
- test/gemfiles/activerecord41.gemfile
|
19
|
+
- test/gemfiles/activerecord40.gemfile
|
20
|
+
- test/gemfiles/activerecord32.gemfile
|
21
|
+
- test/gemfiles/activerecord31.gemfile
|
22
|
+
- test/gemfiles/mongoid2.gemfile
|
23
|
+
- test/gemfiles/mongoid3.gemfile
|
24
|
+
- test/gemfiles/mongoid4.gemfile
|
25
|
+
- test/gemfiles/mongoid5.gemfile
|
26
|
+
env:
|
27
|
+
- ELASTICSEARCH_VERSION=2.3.0
|
28
|
+
matrix:
|
29
|
+
include:
|
30
|
+
- gemfile: Gemfile
|
31
|
+
env: ELASTICSEARCH_VERSION=1.0.0
|
32
|
+
- gemfile: Gemfile
|
33
|
+
env: ELASTICSEARCH_VERSION=1.7.0
|
34
|
+
- gemfile: Gemfile
|
35
|
+
env: ELASTICSEARCH_VERSION=2.0.0
|
36
|
+
- gemfile: Gemfile
|
37
|
+
env: ELASTICSEARCH_VERSION=5.0.0-alpha2
|
38
|
+
# - gemfile: test/gemfiles/nobrainer.gemfile
|
39
|
+
# env: NOBRAINER=true
|
40
|
+
allow_failures:
|
41
|
+
- gemfile: Gemfile
|
42
|
+
env: ELASTICSEARCH_VERSION=5.0.0-alpha2
|
43
|
+
# - gemfile: test/gemfiles/nobrainer.gemfile
|
44
|
+
# env: NOBRAINER=true
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,360 @@
|
|
1
|
+
## 1.3.1
|
2
|
+
|
3
|
+
- Fixed error with Ruby 2.0
|
4
|
+
- Fixed error with indexing large fields
|
5
|
+
|
6
|
+
## 1.3.0
|
7
|
+
|
8
|
+
- Added support for Elasticsearch 5.0 alpha
|
9
|
+
- Added support for phrase matches
|
10
|
+
- Added support for procs for `index_prefix` option
|
11
|
+
|
12
|
+
## 1.2.1
|
13
|
+
|
14
|
+
- Added `multi_search` method
|
15
|
+
- Added support for routing for Elasticsearch 2
|
16
|
+
- Added support for `search_document_id` and `search_document_type` in models
|
17
|
+
- Fixed error with instrumentation for searching multiple models
|
18
|
+
- Fixed instrumentation for bulk updates
|
19
|
+
|
20
|
+
## 1.2.0
|
21
|
+
|
22
|
+
- Fixed deprecation warnings with `alias_method_chain`
|
23
|
+
- Added `analyzed_only` option for large text fields
|
24
|
+
- Added `encoder` option to highlight
|
25
|
+
- Fixed issue in `similar` method with `per_page` option
|
26
|
+
- Added basic support for multiple models
|
27
|
+
|
28
|
+
## 1.1.2
|
29
|
+
|
30
|
+
- Added bulk updates with `callbacks` method
|
31
|
+
- Added `bulk_delete` method
|
32
|
+
- Added `search_timeout` option
|
33
|
+
- Fixed bug with new location format for `boost_by_distance`
|
34
|
+
|
35
|
+
## 1.1.1
|
36
|
+
|
37
|
+
- Added support for `{lat: lat, lon: lon}` as preferred format for locations
|
38
|
+
|
39
|
+
## 1.1.0
|
40
|
+
|
41
|
+
- Added `below` option to misspellings to improve performance
|
42
|
+
- Fixed synonyms for `word_*` partial matches
|
43
|
+
- Added `searchable` option
|
44
|
+
- Added `similarity` option
|
45
|
+
- Added `match` option
|
46
|
+
- Added `word` option
|
47
|
+
- Added highlighted fields to `load: false`
|
48
|
+
|
49
|
+
## 1.0.3
|
50
|
+
|
51
|
+
- Added support for Elasticsearch 2.1
|
52
|
+
|
53
|
+
## 1.0.2
|
54
|
+
|
55
|
+
- Throw `Searchkick::ImportError` for errors when importing records
|
56
|
+
- Errors now inherit from `Searchkick::Error`
|
57
|
+
- Added `order` option to aggregations
|
58
|
+
- Added `mapping` method
|
59
|
+
|
60
|
+
## 1.0.1
|
61
|
+
|
62
|
+
- Added aggregations method to get raw response
|
63
|
+
- Use `execute: false` for lazy loading
|
64
|
+
- Return nil when no aggs
|
65
|
+
- Added emoji search
|
66
|
+
|
67
|
+
## 1.0.0
|
68
|
+
|
69
|
+
- Added support for Elasticsearch 2.0
|
70
|
+
- Added support for aggregations
|
71
|
+
- Added ability to use misspellings for partial matches
|
72
|
+
- Added `fragment_size` option for highlight
|
73
|
+
- Added `took` method to results
|
74
|
+
|
75
|
+
Breaking changes
|
76
|
+
|
77
|
+
- Raise `Searchkick::DangerousOperation` error when calling reindex with scope
|
78
|
+
- Enabled misspellings by default for partial matches
|
79
|
+
- Enabled transpositions by default for misspellings
|
80
|
+
|
81
|
+
## 0.9.1
|
82
|
+
|
83
|
+
- `and` now matches `&`
|
84
|
+
- Added `transpositions` option to misspellings
|
85
|
+
- Added `boost_mode` and `log` options to `boost_by`
|
86
|
+
- Added `prefix_length` option to `misspellings`
|
87
|
+
- Added ability to set env
|
88
|
+
|
89
|
+
## 0.9.0
|
90
|
+
|
91
|
+
- Much better performance for where queries if no facets
|
92
|
+
- Added basic support for regex
|
93
|
+
- Added support for routing
|
94
|
+
- Made `Searchkick.disable_callbacks` thread-safe
|
95
|
+
|
96
|
+
## 0.8.7
|
97
|
+
|
98
|
+
- Fixed Mongoid import
|
99
|
+
|
100
|
+
## 0.8.6
|
101
|
+
|
102
|
+
- Added support for NoBrainer
|
103
|
+
- Added `stem_conversions: false` option
|
104
|
+
- Added support for multiple `boost_where` values on the same field
|
105
|
+
- Added support for array of values for `boost_where`
|
106
|
+
- Fixed suggestions with partial match boost
|
107
|
+
- Fixed redefining existing instance methods in models
|
108
|
+
|
109
|
+
## 0.8.5
|
110
|
+
|
111
|
+
- Added support for Elasticsearch 1.4
|
112
|
+
- Added `unsearchable` option
|
113
|
+
- Added `select: true` option
|
114
|
+
- Added `body` option
|
115
|
+
|
116
|
+
## 0.8.4
|
117
|
+
|
118
|
+
- Added `boost_by_distance`
|
119
|
+
- More flexible highlight options
|
120
|
+
- Better `env` logic
|
121
|
+
|
122
|
+
## 0.8.3
|
123
|
+
|
124
|
+
- Added support for ActiveJob
|
125
|
+
- Added `timeout` setting
|
126
|
+
- Fixed import with no records
|
127
|
+
|
128
|
+
## 0.8.2
|
129
|
+
|
130
|
+
- Added `async` to `callbacks` option
|
131
|
+
- Added `wordnet` option
|
132
|
+
- Added `edit_distance` option to eventually replace `distance` option
|
133
|
+
- Catch misspelling of `misspellings` option
|
134
|
+
- Improved logging
|
135
|
+
|
136
|
+
## 0.8.1
|
137
|
+
|
138
|
+
- Added `search_method_name` option
|
139
|
+
- Fixed `order` for array of hashes
|
140
|
+
- Added support for Mongoid 2
|
141
|
+
|
142
|
+
## 0.8.0
|
143
|
+
|
144
|
+
- Added support for Elasticsearch 1.2
|
145
|
+
|
146
|
+
## 0.7.9
|
147
|
+
|
148
|
+
- Added `tokens` method
|
149
|
+
- Added `json` option
|
150
|
+
- Added exact matches
|
151
|
+
- Added `prev_page` for Kaminari pagination
|
152
|
+
- Added `import` option to reindex
|
153
|
+
|
154
|
+
## 0.7.8
|
155
|
+
|
156
|
+
- Added `boost_by` and `boost_where` options
|
157
|
+
- Added ability to boost fields - `name^10`
|
158
|
+
- Added `select` option for `load: false`
|
159
|
+
|
160
|
+
## 0.7.7
|
161
|
+
|
162
|
+
- Added support for automatic failover
|
163
|
+
- Fixed `operator` option (and default) for partial matches
|
164
|
+
|
165
|
+
## 0.7.6
|
166
|
+
|
167
|
+
- Added `stats` option to facets
|
168
|
+
- Added `padding` option
|
169
|
+
|
170
|
+
## 0.7.5
|
171
|
+
|
172
|
+
- Do not throw errors when index becomes out of sync with database
|
173
|
+
- Added custom exception types
|
174
|
+
- Fixed `offset` and `offset_value`
|
175
|
+
|
176
|
+
## 0.7.4
|
177
|
+
|
178
|
+
- Fixed reindex with inheritance
|
179
|
+
|
180
|
+
## 0.7.3
|
181
|
+
|
182
|
+
- Fixed multi-index searches
|
183
|
+
- Fixed suggestions for partial matches
|
184
|
+
- Added `offset` and `length` for improved pagination
|
185
|
+
|
186
|
+
## 0.7.2
|
187
|
+
|
188
|
+
- Added smart facets
|
189
|
+
- Added more fields to `load: false` result
|
190
|
+
- Fixed logging for multi-index searches
|
191
|
+
- Added `first_page?` and `last_page?` for improved Kaminari support
|
192
|
+
|
193
|
+
## 0.7.1
|
194
|
+
|
195
|
+
- Fixed huge issue w/ zero-downtime reindexing on 0.90
|
196
|
+
|
197
|
+
## 0.7.0
|
198
|
+
|
199
|
+
- Added support for Elasticsearch 1.1
|
200
|
+
- Dropped support for Elasticsearch below 0.90.4 (unfortunate side effect of above)
|
201
|
+
|
202
|
+
## 0.6.3
|
203
|
+
|
204
|
+
- Removed patron since no support for Windows
|
205
|
+
- Added error if `searchkick` is called multiple times
|
206
|
+
|
207
|
+
## 0.6.2
|
208
|
+
|
209
|
+
- Added logging
|
210
|
+
- Fixed index_name option
|
211
|
+
- Added ability to use proc as the index name
|
212
|
+
|
213
|
+
## 0.6.1
|
214
|
+
|
215
|
+
- Fixed huge issue w/ zero-downtime reindexing on 0.90 and elasticsearch-ruby 1.0
|
216
|
+
- Restore load: false behavior
|
217
|
+
- Restore total_entries method
|
218
|
+
|
219
|
+
## 0.6.0
|
220
|
+
|
221
|
+
- Moved to elasticsearch-ruby
|
222
|
+
- Added support for modifying the query and viewing the response
|
223
|
+
- Added support for page_entries_info method
|
224
|
+
|
225
|
+
## 0.5.3
|
226
|
+
|
227
|
+
- Fixed bug w/ word_* queries
|
228
|
+
|
229
|
+
## 0.5.2
|
230
|
+
|
231
|
+
- Use after_commit hook for ActiveRecord to prevent data inconsistencies
|
232
|
+
|
233
|
+
## 0.5.1
|
234
|
+
|
235
|
+
- Replaced stop words with common terms query
|
236
|
+
- Added language option
|
237
|
+
- Fixed bug with empty array in where clause
|
238
|
+
- Fixed bug with MongoDB integer _id
|
239
|
+
- Fixed reindex bug when callbacks disabled
|
240
|
+
|
241
|
+
## 0.5.0
|
242
|
+
|
243
|
+
- Better control over partial matches
|
244
|
+
- Added merge_mappings option
|
245
|
+
- Added batch_size option
|
246
|
+
- Fixed bug with nil where clauses
|
247
|
+
|
248
|
+
## 0.4.2
|
249
|
+
|
250
|
+
- Added `should_index?` method to control which records are indexed
|
251
|
+
- Added ability to temporarily disable callbacks
|
252
|
+
- Added custom mappings
|
253
|
+
|
254
|
+
## 0.4.1
|
255
|
+
|
256
|
+
- Fixed issue w/ inheritance mapping
|
257
|
+
|
258
|
+
## 0.4.0
|
259
|
+
|
260
|
+
- Added support for Mongoid 4
|
261
|
+
- Added support for multiple locations
|
262
|
+
|
263
|
+
## 0.3.5
|
264
|
+
|
265
|
+
- Added facet ranges
|
266
|
+
- Added all operator
|
267
|
+
|
268
|
+
## 0.3.4
|
269
|
+
|
270
|
+
- Added highlighting
|
271
|
+
- Added :distance option to misspellings
|
272
|
+
- Fixed issue w/ BigDecimal serialization
|
273
|
+
|
274
|
+
## 0.3.3
|
275
|
+
|
276
|
+
- Better error messages
|
277
|
+
- Added where: {field: nil} queries
|
278
|
+
|
279
|
+
## 0.3.2
|
280
|
+
|
281
|
+
- Added support for single table inheritance
|
282
|
+
- Removed Tire::Model::Search
|
283
|
+
|
284
|
+
## 0.3.1
|
285
|
+
|
286
|
+
- Added index_prefix option
|
287
|
+
- Fixed ES issue with incorrect facet counts
|
288
|
+
- Added option to turn off special characters
|
289
|
+
|
290
|
+
## 0.3.0
|
291
|
+
|
292
|
+
- Fixed reversed coordinates
|
293
|
+
- Added bounded by a box queries
|
294
|
+
- Expanded `or` queries
|
295
|
+
|
296
|
+
## 0.2.8
|
297
|
+
|
298
|
+
- Added option to disable callbacks
|
299
|
+
- Fixed bug with facets with Elasticsearch 0.90.5
|
300
|
+
|
301
|
+
## 0.2.7
|
302
|
+
|
303
|
+
- Added limit to facet
|
304
|
+
- Improved similar items
|
305
|
+
|
306
|
+
## 0.2.6
|
307
|
+
|
308
|
+
- Added option to disable misspellings
|
309
|
+
|
310
|
+
## 0.2.5
|
311
|
+
|
312
|
+
- Added geospartial searches
|
313
|
+
- Create alias before importing document if no alias exists
|
314
|
+
- Fixed exception when :per_page option is a string
|
315
|
+
- Check `RAILS_ENV` if `RACK_ENV` is not set
|
316
|
+
|
317
|
+
## 0.2.4
|
318
|
+
|
319
|
+
- Use `to_hash` instead of `as_json` for default `search_data` method
|
320
|
+
- Works for Mongoid 1.3
|
321
|
+
- Use one shard in test environment for consistent scores
|
322
|
+
|
323
|
+
## 0.2.3
|
324
|
+
|
325
|
+
- Setup Travis
|
326
|
+
- Clean old indices before reindex
|
327
|
+
- Search for `*` returns all results
|
328
|
+
- Fixed pagination
|
329
|
+
- Added `similar` method
|
330
|
+
|
331
|
+
## 0.2.2
|
332
|
+
|
333
|
+
- Clean old indices after reindex
|
334
|
+
- More expansions for fuzzy queries
|
335
|
+
|
336
|
+
## 0.2.1
|
337
|
+
|
338
|
+
- Added Rails logger
|
339
|
+
- Only fetch ids when `load: true`
|
340
|
+
|
341
|
+
## 0.2.0
|
342
|
+
|
343
|
+
- Added autocomplete
|
344
|
+
- Added “Did you mean” suggestions
|
345
|
+
- Added personalized searches
|
346
|
+
|
347
|
+
## 0.1.4
|
348
|
+
|
349
|
+
- Bug fix
|
350
|
+
|
351
|
+
## 0.1.3
|
352
|
+
|
353
|
+
- Changed edit distance to one for misspellings
|
354
|
+
- Raise errors when indexing fails
|
355
|
+
- Fixed pagination
|
356
|
+
- Fixed :include option
|
357
|
+
|
358
|
+
## 0.1.2
|
359
|
+
|
360
|
+
- Launch
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013-2016 Andrew Kane
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|