chewy 0.9.0 → 5.2.0

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.
Files changed (275) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +214 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +41 -19
  5. data/.rubocop_todo.yml +2 -2
  6. data/.yardopts +5 -0
  7. data/Appraisals +58 -28
  8. data/CHANGELOG.md +153 -12
  9. data/Gemfile +20 -12
  10. data/LEGACY_DSL.md +497 -0
  11. data/LICENSE.txt +1 -1
  12. data/README.md +338 -528
  13. data/chewy.gemspec +11 -12
  14. data/gemfiles/rails.5.2.activerecord.gemfile +17 -0
  15. data/gemfiles/rails.5.2.mongoid.6.4.gemfile +17 -0
  16. data/gemfiles/rails.6.0.activerecord.gemfile +17 -0
  17. data/gemfiles/rails.6.1.activerecord.gemfile +19 -0
  18. data/gemfiles/ruby3.gemfile +10 -0
  19. data/gemfiles/sequel.4.45.gemfile +11 -0
  20. data/lib/chewy.rb +79 -44
  21. data/lib/chewy/backports/duplicable.rb +1 -1
  22. data/lib/chewy/config.rb +43 -17
  23. data/lib/chewy/errors.rb +2 -2
  24. data/lib/chewy/fields/base.rb +56 -31
  25. data/lib/chewy/fields/root.rb +44 -11
  26. data/lib/chewy/index.rb +237 -149
  27. data/lib/chewy/index/actions.rb +100 -35
  28. data/lib/chewy/index/aliases.rb +2 -1
  29. data/lib/chewy/index/settings.rb +11 -5
  30. data/lib/chewy/index/specification.rb +60 -0
  31. data/lib/chewy/journal.rb +40 -92
  32. data/lib/chewy/minitest/helpers.rb +6 -6
  33. data/lib/chewy/minitest/search_index_receiver.rb +17 -17
  34. data/lib/chewy/query.rb +182 -122
  35. data/lib/chewy/query/compose.rb +13 -13
  36. data/lib/chewy/query/criteria.rb +13 -13
  37. data/lib/chewy/query/filters.rb +21 -4
  38. data/lib/chewy/query/loading.rb +1 -2
  39. data/lib/chewy/query/nodes/and.rb +2 -2
  40. data/lib/chewy/query/nodes/bool.rb +1 -1
  41. data/lib/chewy/query/nodes/equal.rb +2 -2
  42. data/lib/chewy/query/nodes/exists.rb +1 -1
  43. data/lib/chewy/query/nodes/field.rb +1 -1
  44. data/lib/chewy/query/nodes/has_relation.rb +2 -2
  45. data/lib/chewy/query/nodes/match_all.rb +1 -1
  46. data/lib/chewy/query/nodes/missing.rb +1 -1
  47. data/lib/chewy/query/nodes/not.rb +2 -2
  48. data/lib/chewy/query/nodes/or.rb +2 -2
  49. data/lib/chewy/query/nodes/prefix.rb +1 -1
  50. data/lib/chewy/query/nodes/query.rb +2 -2
  51. data/lib/chewy/query/nodes/range.rb +4 -4
  52. data/lib/chewy/query/nodes/regexp.rb +4 -4
  53. data/lib/chewy/query/nodes/script.rb +3 -3
  54. data/lib/chewy/query/pagination.rb +10 -1
  55. data/lib/chewy/railtie.rb +4 -3
  56. data/lib/chewy/rake_helper.rb +265 -48
  57. data/lib/chewy/rspec/update_index.rb +33 -27
  58. data/lib/chewy/search.rb +79 -26
  59. data/lib/chewy/search/loader.rb +83 -0
  60. data/lib/chewy/{query → search}/pagination/kaminari.rb +13 -5
  61. data/lib/chewy/search/pagination/will_paginate.rb +43 -0
  62. data/lib/chewy/search/parameters.rb +168 -0
  63. data/lib/chewy/search/parameters/aggs.rb +16 -0
  64. data/lib/chewy/search/parameters/allow_partial_search_results.rb +27 -0
  65. data/lib/chewy/search/parameters/concerns/bool_storage.rb +24 -0
  66. data/lib/chewy/search/parameters/concerns/hash_storage.rb +23 -0
  67. data/lib/chewy/search/parameters/concerns/integer_storage.rb +14 -0
  68. data/lib/chewy/search/parameters/concerns/query_storage.rb +238 -0
  69. data/lib/chewy/search/parameters/concerns/string_array_storage.rb +23 -0
  70. data/lib/chewy/search/parameters/concerns/string_storage.rb +14 -0
  71. data/lib/chewy/search/parameters/docvalue_fields.rb +12 -0
  72. data/lib/chewy/search/parameters/explain.rb +16 -0
  73. data/lib/chewy/search/parameters/filter.rb +47 -0
  74. data/lib/chewy/search/parameters/highlight.rb +16 -0
  75. data/lib/chewy/search/parameters/indices.rb +123 -0
  76. data/lib/chewy/search/parameters/indices_boost.rb +52 -0
  77. data/lib/chewy/search/parameters/limit.rb +17 -0
  78. data/lib/chewy/search/parameters/load.rb +32 -0
  79. data/lib/chewy/search/parameters/min_score.rb +16 -0
  80. data/lib/chewy/search/parameters/none.rb +27 -0
  81. data/lib/chewy/search/parameters/offset.rb +17 -0
  82. data/lib/chewy/search/parameters/order.rb +64 -0
  83. data/lib/chewy/search/parameters/post_filter.rb +19 -0
  84. data/lib/chewy/search/parameters/preference.rb +16 -0
  85. data/lib/chewy/search/parameters/profile.rb +16 -0
  86. data/lib/chewy/search/parameters/query.rb +19 -0
  87. data/lib/chewy/search/parameters/request_cache.rb +27 -0
  88. data/lib/chewy/search/parameters/rescore.rb +29 -0
  89. data/lib/chewy/search/parameters/script_fields.rb +16 -0
  90. data/lib/chewy/search/parameters/search_after.rb +20 -0
  91. data/lib/chewy/search/parameters/search_type.rb +16 -0
  92. data/lib/chewy/search/parameters/source.rb +73 -0
  93. data/lib/chewy/search/parameters/storage.rb +95 -0
  94. data/lib/chewy/search/parameters/stored_fields.rb +63 -0
  95. data/lib/chewy/search/parameters/suggest.rb +16 -0
  96. data/lib/chewy/search/parameters/terminate_after.rb +16 -0
  97. data/lib/chewy/search/parameters/timeout.rb +16 -0
  98. data/lib/chewy/search/parameters/track_scores.rb +16 -0
  99. data/lib/chewy/search/parameters/types.rb +20 -0
  100. data/lib/chewy/search/parameters/version.rb +16 -0
  101. data/lib/chewy/search/query_proxy.rb +257 -0
  102. data/lib/chewy/search/request.rb +1046 -0
  103. data/lib/chewy/search/response.rb +119 -0
  104. data/lib/chewy/search/scoping.rb +50 -0
  105. data/lib/chewy/search/scrolling.rb +134 -0
  106. data/lib/chewy/stash.rb +79 -0
  107. data/lib/chewy/strategy.rb +10 -3
  108. data/lib/chewy/strategy/active_job.rb +2 -1
  109. data/lib/chewy/strategy/atomic.rb +2 -4
  110. data/lib/chewy/strategy/bypass.rb +1 -1
  111. data/lib/chewy/strategy/resque.rb +1 -0
  112. data/lib/chewy/strategy/shoryuken.rb +40 -0
  113. data/lib/chewy/strategy/sidekiq.rb +13 -3
  114. data/lib/chewy/type.rb +29 -7
  115. data/lib/chewy/type/actions.rb +26 -2
  116. data/lib/chewy/type/adapter/active_record.rb +44 -29
  117. data/lib/chewy/type/adapter/base.rb +27 -7
  118. data/lib/chewy/type/adapter/mongoid.rb +19 -10
  119. data/lib/chewy/type/adapter/object.rb +187 -26
  120. data/lib/chewy/type/adapter/orm.rb +59 -32
  121. data/lib/chewy/type/adapter/sequel.rb +33 -19
  122. data/lib/chewy/type/crutch.rb +1 -1
  123. data/lib/chewy/type/import.rb +146 -191
  124. data/lib/chewy/type/import/bulk_builder.rb +122 -0
  125. data/lib/chewy/type/import/bulk_request.rb +78 -0
  126. data/lib/chewy/type/import/journal_builder.rb +45 -0
  127. data/lib/chewy/type/import/routine.rb +138 -0
  128. data/lib/chewy/type/mapping.rb +51 -35
  129. data/lib/chewy/type/observe.rb +17 -13
  130. data/lib/chewy/type/syncer.rb +222 -0
  131. data/lib/chewy/type/witchcraft.rb +32 -16
  132. data/lib/chewy/type/wrapper.rb +30 -4
  133. data/lib/chewy/version.rb +1 -1
  134. data/lib/sequel/plugins/chewy_observe.rb +4 -19
  135. data/lib/tasks/chewy.rake +84 -26
  136. data/spec/chewy/config_spec.rb +98 -1
  137. data/spec/chewy/fields/base_spec.rb +170 -135
  138. data/spec/chewy/fields/root_spec.rb +124 -20
  139. data/spec/chewy/fields/time_fields_spec.rb +2 -3
  140. data/spec/chewy/index/actions_spec.rb +214 -52
  141. data/spec/chewy/index/aliases_spec.rb +2 -2
  142. data/spec/chewy/index/settings_spec.rb +67 -38
  143. data/spec/chewy/index/specification_spec.rb +169 -0
  144. data/spec/chewy/index_spec.rb +108 -64
  145. data/spec/chewy/journal_spec.rb +150 -55
  146. data/spec/chewy/minitest/helpers_spec.rb +4 -4
  147. data/spec/chewy/minitest/search_index_receiver_spec.rb +1 -1
  148. data/spec/chewy/query/criteria_spec.rb +179 -179
  149. data/spec/chewy/query/filters_spec.rb +16 -16
  150. data/spec/chewy/query/loading_spec.rb +22 -20
  151. data/spec/chewy/query/nodes/and_spec.rb +2 -2
  152. data/spec/chewy/query/nodes/bool_spec.rb +4 -4
  153. data/spec/chewy/query/nodes/equal_spec.rb +19 -19
  154. data/spec/chewy/query/nodes/exists_spec.rb +6 -6
  155. data/spec/chewy/query/nodes/has_child_spec.rb +19 -19
  156. data/spec/chewy/query/nodes/has_parent_spec.rb +19 -19
  157. data/spec/chewy/query/nodes/missing_spec.rb +5 -5
  158. data/spec/chewy/query/nodes/not_spec.rb +4 -2
  159. data/spec/chewy/query/nodes/or_spec.rb +2 -2
  160. data/spec/chewy/query/nodes/prefix_spec.rb +5 -5
  161. data/spec/chewy/query/nodes/query_spec.rb +2 -2
  162. data/spec/chewy/query/nodes/range_spec.rb +18 -18
  163. data/spec/chewy/query/nodes/raw_spec.rb +1 -1
  164. data/spec/chewy/query/nodes/regexp_spec.rb +14 -14
  165. data/spec/chewy/query/nodes/script_spec.rb +4 -4
  166. data/spec/chewy/query/pagination/kaminari_spec.rb +3 -55
  167. data/spec/chewy/query/pagination/will_paginate_spec.rb +5 -0
  168. data/spec/chewy/query/pagination_spec.rb +25 -21
  169. data/spec/chewy/query_spec.rb +503 -561
  170. data/spec/chewy/rake_helper_spec.rb +381 -0
  171. data/spec/chewy/repository_spec.rb +4 -4
  172. data/spec/chewy/rspec/update_index_spec.rb +89 -56
  173. data/spec/chewy/runtime_spec.rb +2 -2
  174. data/spec/chewy/search/loader_spec.rb +117 -0
  175. data/spec/chewy/search/pagination/kaminari_examples.rb +71 -0
  176. data/spec/chewy/search/pagination/kaminari_spec.rb +21 -0
  177. data/spec/chewy/search/pagination/will_paginate_examples.rb +63 -0
  178. data/spec/chewy/search/pagination/will_paginate_spec.rb +23 -0
  179. data/spec/chewy/search/parameters/aggs_spec.rb +5 -0
  180. data/spec/chewy/search/parameters/bool_storage_examples.rb +53 -0
  181. data/spec/chewy/search/parameters/docvalue_fields_spec.rb +5 -0
  182. data/spec/chewy/search/parameters/explain_spec.rb +5 -0
  183. data/spec/chewy/search/parameters/filter_spec.rb +5 -0
  184. data/spec/chewy/search/parameters/hash_storage_examples.rb +59 -0
  185. data/spec/chewy/search/parameters/highlight_spec.rb +5 -0
  186. data/spec/chewy/search/parameters/indices_spec.rb +191 -0
  187. data/spec/chewy/search/parameters/integer_storage_examples.rb +32 -0
  188. data/spec/chewy/search/parameters/limit_spec.rb +5 -0
  189. data/spec/chewy/search/parameters/load_spec.rb +60 -0
  190. data/spec/chewy/search/parameters/min_score_spec.rb +32 -0
  191. data/spec/chewy/search/parameters/none_spec.rb +5 -0
  192. data/spec/chewy/search/parameters/offset_spec.rb +5 -0
  193. data/spec/chewy/search/parameters/order_spec.rb +65 -0
  194. data/spec/chewy/search/parameters/post_filter_spec.rb +5 -0
  195. data/spec/chewy/search/parameters/preference_spec.rb +5 -0
  196. data/spec/chewy/search/parameters/profile_spec.rb +5 -0
  197. data/spec/chewy/search/parameters/query_spec.rb +5 -0
  198. data/spec/chewy/search/parameters/query_storage_examples.rb +388 -0
  199. data/spec/chewy/search/parameters/request_cache_spec.rb +67 -0
  200. data/spec/chewy/search/parameters/rescore_spec.rb +62 -0
  201. data/spec/chewy/search/parameters/script_fields_spec.rb +5 -0
  202. data/spec/chewy/search/parameters/search_after_spec.rb +32 -0
  203. data/spec/chewy/search/parameters/search_type_spec.rb +5 -0
  204. data/spec/chewy/search/parameters/source_spec.rb +156 -0
  205. data/spec/chewy/search/parameters/storage_spec.rb +60 -0
  206. data/spec/chewy/search/parameters/stored_fields_spec.rb +126 -0
  207. data/spec/chewy/search/parameters/string_array_storage_examples.rb +63 -0
  208. data/spec/chewy/search/parameters/string_storage_examples.rb +32 -0
  209. data/spec/chewy/search/parameters/suggest_spec.rb +5 -0
  210. data/spec/chewy/search/parameters/terminate_after_spec.rb +5 -0
  211. data/spec/chewy/search/parameters/timeout_spec.rb +5 -0
  212. data/spec/chewy/search/parameters/track_scores_spec.rb +5 -0
  213. data/spec/chewy/search/parameters/types_spec.rb +5 -0
  214. data/spec/chewy/search/parameters/version_spec.rb +5 -0
  215. data/spec/chewy/search/parameters_spec.rb +147 -0
  216. data/spec/chewy/search/query_proxy_spec.rb +68 -0
  217. data/spec/chewy/search/request_spec.rb +685 -0
  218. data/spec/chewy/search/response_spec.rb +198 -0
  219. data/spec/chewy/search/scrolling_spec.rb +169 -0
  220. data/spec/chewy/search_spec.rb +33 -16
  221. data/spec/chewy/stash_spec.rb +95 -0
  222. data/spec/chewy/strategy/active_job_spec.rb +21 -2
  223. data/spec/chewy/strategy/resque_spec.rb +6 -0
  224. data/spec/chewy/strategy/shoryuken_spec.rb +70 -0
  225. data/spec/chewy/strategy/sidekiq_spec.rb +13 -1
  226. data/spec/chewy/strategy_spec.rb +6 -6
  227. data/spec/chewy/type/actions_spec.rb +29 -10
  228. data/spec/chewy/type/adapter/active_record_spec.rb +203 -91
  229. data/spec/chewy/type/adapter/mongoid_spec.rb +112 -54
  230. data/spec/chewy/type/adapter/object_spec.rb +101 -28
  231. data/spec/chewy/type/adapter/sequel_spec.rb +149 -82
  232. data/spec/chewy/type/import/bulk_builder_spec.rb +279 -0
  233. data/spec/chewy/type/import/bulk_request_spec.rb +102 -0
  234. data/spec/chewy/type/import/journal_builder_spec.rb +95 -0
  235. data/spec/chewy/type/import/routine_spec.rb +110 -0
  236. data/spec/chewy/type/import_spec.rb +356 -271
  237. data/spec/chewy/type/mapping_spec.rb +96 -29
  238. data/spec/chewy/type/observe_spec.rb +9 -5
  239. data/spec/chewy/type/syncer_spec.rb +123 -0
  240. data/spec/chewy/type/witchcraft_spec.rb +61 -29
  241. data/spec/chewy/type/wrapper_spec.rb +63 -23
  242. data/spec/chewy/type_spec.rb +28 -7
  243. data/spec/chewy_spec.rb +75 -7
  244. data/spec/spec_helper.rb +17 -3
  245. data/spec/support/active_record.rb +5 -1
  246. data/spec/support/class_helpers.rb +0 -14
  247. data/spec/support/mongoid.rb +15 -3
  248. data/spec/support/sequel.rb +6 -1
  249. metadata +219 -58
  250. data/.travis.yml +0 -36
  251. data/gemfiles/rails.3.2.activerecord.gemfile +0 -16
  252. data/gemfiles/rails.3.2.activerecord.kaminari.gemfile +0 -15
  253. data/gemfiles/rails.3.2.activerecord.will_paginate.gemfile +0 -15
  254. data/gemfiles/rails.4.2.activerecord.gemfile +0 -17
  255. data/gemfiles/rails.4.2.activerecord.kaminari.gemfile +0 -16
  256. data/gemfiles/rails.4.2.activerecord.will_paginate.gemfile +0 -16
  257. data/gemfiles/rails.4.2.mongoid.4.0.gemfile +0 -16
  258. data/gemfiles/rails.4.2.mongoid.4.0.kaminari.gemfile +0 -15
  259. data/gemfiles/rails.4.2.mongoid.4.0.will_paginate.gemfile +0 -15
  260. data/gemfiles/rails.4.2.mongoid.5.1.gemfile +0 -16
  261. data/gemfiles/rails.4.2.mongoid.5.1.kaminari.gemfile +0 -15
  262. data/gemfiles/rails.4.2.mongoid.5.1.will_paginate.gemfile +0 -15
  263. data/gemfiles/rails.5.0.activerecord.gemfile +0 -17
  264. data/gemfiles/rails.5.0.activerecord.kaminari.gemfile +0 -16
  265. data/gemfiles/rails.5.0.activerecord.will_paginate.gemfile +0 -16
  266. data/gemfiles/sequel.4.38.gemfile +0 -14
  267. data/lib/chewy/journal/apply.rb +0 -31
  268. data/lib/chewy/journal/clean.rb +0 -24
  269. data/lib/chewy/journal/entry.rb +0 -83
  270. data/lib/chewy/journal/query.rb +0 -87
  271. data/lib/chewy/query/pagination/will_paginate.rb +0 -27
  272. data/lib/chewy/query/scoping.rb +0 -20
  273. data/spec/chewy/journal/apply_spec.rb +0 -120
  274. data/spec/chewy/journal/entry_spec.rb +0 -237
  275. data/spec/chewy/query/pagination/will_paginage_spec.rb +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: de7c5c4e672dfb909540467bf37a13aaa21933c1
4
- data.tar.gz: 1e6a424a74805c9e19495f9c2d33a1e16cd0a843
2
+ SHA256:
3
+ metadata.gz: ce34ae965f4efd39230e5e7fd8cd6d63a17c5e645745f7565ad4feea944244bb
4
+ data.tar.gz: b4fcade45c69fd1003b22d0b3a1a7e6e1f2f042f422fcf5dc510250d7c63bf6f
5
5
  SHA512:
6
- metadata.gz: 9a7b5152aa2def448318b81b1fbac395ad652620c079c8013332e5e44ffebcfb27932688d81b7116f95447e37ebe715630307bf45e010f6964ff12a618a97d97
7
- data.tar.gz: 370c365d9d690e29e5ab7de4ba06f0dff07aa360edbb7f18c982bf2c6f288b1bdd7554bb8bc569993d82553c696e44c3c726ab5c11db278b1d6fcc4c472b4998
6
+ metadata.gz: 2266cf1f1b14d4dd70f0c34c07f3b722fc8a15b9532bc8a7c332f387634982b3ccac87a1bb692ca0023d588692cfb3f090f2410f3775a3e2678f3d08d762045a
7
+ data.tar.gz: 9ca016cc817585547e994597a08e14c7484dc13a5f9a7d35b1685cb9135b604b0ba94221120c87dbe4a2b6c3e67dec3a105f2de2014eb82e8081b45dad960f31
@@ -0,0 +1,214 @@
1
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
2
+ version: 2.1
3
+
4
+ es56-env: &es56-env
5
+ cluster.name: elasticsearch
6
+ transport.host: localhost
7
+ network.host: 127.0.0.1
8
+ http.port: 9250
9
+ discovery.type: single-node
10
+ xpack.security.enabled: false
11
+ xpack.monitoring.enabled: false
12
+
13
+ workflows:
14
+ build:
15
+ jobs:
16
+ - rubocop
17
+ - rspec-ruby-26-activerecord61
18
+ - rspec-ruby-26-activerecord60
19
+ - rspec-ruby-26-activerecord52
20
+ - rspec-ruby-26-mongoid
21
+ - rspec-ruby-27-activerecord61
22
+ - rspec-ruby-27-activerecord60
23
+ - rspec-ruby-27-activerecord52
24
+ - rspec-ruby-27-mongoid
25
+ - rspec-ruby-30-activerecord61
26
+
27
+ commands:
28
+ rspec-test:
29
+ description: Test rspec in current ruby
30
+ parameters:
31
+ pre-steps:
32
+ description: Necessary steps after checkout
33
+ type: steps
34
+ default: []
35
+ steps:
36
+ - checkout
37
+ - run:
38
+ name: ruby version
39
+ command: |
40
+ ruby -e "STDERR.puts RUBY_VERSION; puts RUBY_VERSION.gsub(/^(\d+)\.(\d+)\..*/, '\1_\2')" > .ruby.version
41
+ - run:
42
+ name: Gemfile.lock version
43
+ command: |
44
+ echo "$GEMFILE.lock" > .Gemfile.lock.path
45
+ - steps: << parameters.pre-steps >>
46
+ - restore_cache:
47
+ keys:
48
+ - dependencies-{{ checksum ".ruby.version" }}-{{ checksum ".Gemfile.lock.path" }}
49
+ - run:
50
+ name: install dependencies
51
+ command: |
52
+ bundle install --jobs=4 --retry=3 --path vendor/bundle --gemfile=$GEMFILE
53
+ - save_cache:
54
+ paths:
55
+ - ./vendor/bundle
56
+ key: dependencies-{{ checksum ".ruby.version" }}-{{ checksum ".Gemfile.lock.path" }}
57
+ - run:
58
+ name: Disable replication of elastic indices
59
+ command: |
60
+ curl -XPUT 'http://localhost:9250/_all/_settings?preserve_existing=true' -d '{
61
+ "index.number_of_replicas":"0"
62
+ }'
63
+ - run:
64
+ name: run tests
65
+ command: |
66
+ ruby -v
67
+ git config --global user.email "you@example.com"
68
+ git config --global user.name "Your Name"
69
+ mkdir /tmp/test-results
70
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
71
+ BUNDLE_GEMFILE=$GEMFILE bundle exec rspec --format progress --format RspecJunitFormatter --out /tmp/test-results/rspec.xml $TEST_FILES
72
+ - store_test_results:
73
+ path: /tmp/test-results
74
+
75
+ jobs:
76
+ rubocop:
77
+ docker:
78
+ - image: circleci/ruby:2.6
79
+ working_directory: ~/repo
80
+ steps:
81
+ - checkout
82
+ - run:
83
+ name: ruby version
84
+ command: |
85
+ ruby -e "STDERR.puts RUBY_VERSION; puts RUBY_VERSION.gsub(/^(\d+)\.(\d+)\..*/, '\1_\2')" > .ruby.version
86
+ - run:
87
+ name: Gemfile.lock version
88
+ command: |
89
+ echo "$GEMFILE.lock" > .Gemfile.lock.path
90
+ - restore_cache:
91
+ keys:
92
+ - dependencies-{{ checksum ".ruby.version" }}-{{ checksum ".Gemfile.lock.path" }}
93
+ - run:
94
+ name: install dependencies
95
+ command: |
96
+ bundle install --jobs=4 --retry=3 --path vendor/bundle --binstubs=/usr/local/bundle/bin
97
+ - save_cache:
98
+ paths:
99
+ - ./vendor/bundle
100
+ key: dependencies-{{ checksum ".ruby.version" }}-{{ checksum ".Gemfile.lock.path" }}
101
+ - run:
102
+ name: run rubocop
103
+ command: |
104
+ bundle exec rubocop --format simple
105
+
106
+ rspec-ruby-26-activerecord52:
107
+ docker:
108
+ - image: circleci/ruby:2.6
109
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
110
+ environment:
111
+ <<: *es56-env
112
+ working_directory: ~/repo
113
+ environment:
114
+ GEMFILE: gemfiles/rails.5.2.activerecord.gemfile
115
+ steps:
116
+ - rspec-test
117
+
118
+ rspec-ruby-26-activerecord60:
119
+ docker:
120
+ - image: circleci/ruby:2.6
121
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
122
+ environment:
123
+ <<: *es56-env
124
+ working_directory: ~/repo
125
+ environment:
126
+ GEMFILE: gemfiles/rails.6.0.activerecord.gemfile
127
+ steps:
128
+ - rspec-test
129
+
130
+ rspec-ruby-26-activerecord61:
131
+ docker:
132
+ - image: circleci/ruby:2.6
133
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
134
+ environment:
135
+ <<: *es56-env
136
+ working_directory: ~/repo
137
+ environment:
138
+ GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
139
+ steps:
140
+ - rspec-test
141
+
142
+ rspec-ruby-26-mongoid:
143
+ docker:
144
+ - image: circleci/ruby:2.6
145
+ - image: circleci/mongo:4.2.5
146
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
147
+ environment:
148
+ <<: *es56-env
149
+ working_directory: ~/repo
150
+ environment:
151
+ GEMFILE: gemfiles/rails.5.2.mongoid.6.4.gemfile
152
+ steps:
153
+ - rspec-test
154
+
155
+ rspec-ruby-27-activerecord52:
156
+ docker:
157
+ - image: circleci/ruby:2.7
158
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
159
+ environment:
160
+ <<: *es56-env
161
+ working_directory: ~/repo
162
+ environment:
163
+ GEMFILE: gemfiles/rails.5.2.activerecord.gemfile
164
+ steps:
165
+ - rspec-test
166
+
167
+ rspec-ruby-27-activerecord60:
168
+ docker:
169
+ - image: circleci/ruby:2.7
170
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
171
+ environment:
172
+ <<: *es56-env
173
+ working_directory: ~/repo
174
+ environment:
175
+ GEMFILE: gemfiles/rails.6.0.activerecord.gemfile
176
+ steps:
177
+ - rspec-test
178
+
179
+ rspec-ruby-27-activerecord61:
180
+ docker:
181
+ - image: circleci/ruby:2.7
182
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
183
+ environment:
184
+ <<: *es56-env
185
+ working_directory: ~/repo
186
+ environment:
187
+ GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
188
+ steps:
189
+ - rspec-test
190
+
191
+ rspec-ruby-27-mongoid:
192
+ docker:
193
+ - image: circleci/ruby:2.7
194
+ - image: circleci/mongo:4.2.5
195
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
196
+ environment:
197
+ <<: *es56-env
198
+ working_directory: ~/repo
199
+ environment:
200
+ GEMFILE: gemfiles/rails.5.2.mongoid.6.4.gemfile
201
+ steps:
202
+ - rspec-test
203
+
204
+ rspec-ruby-30-activerecord61:
205
+ docker:
206
+ - image: circleci/ruby:3.0
207
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
208
+ environment:
209
+ <<: *es56-env
210
+ working_directory: ~/repo
211
+ environment:
212
+ GEMFILE: gemfiles/rails.6.1.activerecord.gemfile
213
+ steps:
214
+ - rspec-test
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ tmp
19
19
  .rvmrc
20
20
  _site
21
21
  .sass-cache
22
+ file::memory:?cache=shared
@@ -1,34 +1,56 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- Lint/EndAlignment:
4
- AlignWith: variable
5
-
6
- Style/AccessModifierIndentation:
3
+ Layout/AccessModifierIndentation:
7
4
  EnforcedStyle: outdent
8
5
 
9
- Style/Alias:
10
- EnforcedStyle: prefer_alias_method
11
-
12
- Style/AlignHash:
6
+ Layout/AlignHash:
13
7
  EnforcedLastArgumentHashStyle: always_ignore
14
8
 
15
- Style/AlignParameters:
9
+ Layout/AlignParameters:
16
10
  EnforcedStyle: with_fixed_indentation
17
11
 
18
- Style/AndOr:
19
- EnforcedStyle: conditionals
20
-
21
- Style/CaseIndentation:
22
- IndentWhenRelativeTo: end
12
+ Layout/CaseIndentation:
13
+ EnforcedStyle: end
23
14
 
24
- Style/DoubleNegation:
25
- Enabled: false
15
+ Layout/IndentArray:
16
+ EnforcedStyle: consistent
26
17
 
27
- Style/IndentArray:
18
+ Layout/IndentHash:
28
19
  EnforcedStyle: consistent
29
20
 
30
- Style/MultilineMethodCallIndentation:
21
+ Layout/IndentHeredoc:
22
+ Enabled: false
23
+
24
+ Layout/MultilineMethodCallIndentation:
31
25
  EnforcedStyle: indented
32
26
 
33
- Style/MultilineOperationIndentation:
27
+ Layout/MultilineOperationIndentation:
34
28
  EnforcedStyle: indented
29
+
30
+ Layout/SpaceInsideHashLiteralBraces:
31
+ EnforcedStyle: no_space
32
+
33
+ Lint/AmbiguousBlockAssociation:
34
+ Enabled: false
35
+
36
+ Lint/EndAlignment:
37
+ EnforcedStyleAlignWith: variable
38
+
39
+ Style/Alias:
40
+ EnforcedStyle: prefer_alias_method
41
+
42
+ Style/AndOr:
43
+ EnforcedStyle: conditionals
44
+
45
+ Style/DoubleNegation:
46
+ Enabled: false
47
+
48
+ Metrics/BlockLength:
49
+ Exclude:
50
+ - '**/*_spec.rb'
51
+ - '**/*_examples.rb'
52
+ - '**/*.rake'
53
+
54
+ Metrics/ModuleLength:
55
+ Exclude:
56
+ - '**/*_spec.rb'
@@ -13,7 +13,7 @@ Metrics/AbcSize:
13
13
  # Offense count: 4
14
14
  # Configuration parameters: CountComments.
15
15
  Metrics/ClassLength:
16
- Max: 280
16
+ Max: 300
17
17
 
18
18
  # Offense count: 14
19
19
  Metrics/CyclomaticComplexity:
@@ -33,7 +33,7 @@ Metrics/MethodLength:
33
33
  # Offense count: 1
34
34
  # Configuration parameters: CountComments.
35
35
  Metrics/ModuleLength:
36
- Max: 172
36
+ Max: 180
37
37
 
38
38
  # Offense count: 14
39
39
  Metrics/PerceivedComplexity:
@@ -0,0 +1,5 @@
1
+ --markup-provider=redcarpet
2
+ --markup=markdown
3
+ -
4
+ README.md
5
+ CHANGELOG.md
data/Appraisals CHANGED
@@ -1,51 +1,81 @@
1
- %w(3.2 4.2 5.0).each do |version|
2
- appraise "rails.#{version}.activerecord" do
3
- gem 'activerecord', "~> #{version}.0"
4
- gem 'activesupport', "~> #{version}.0"
5
- gem 'activejob', "~> #{version}.0" if version >= '4.2'
1
+ %w[4.0 4.1 4.2].each do |activesupport|
2
+ appraise "rails.#{activesupport}.activerecord" do
3
+ gem 'activerecord', "~> #{activesupport}.0"
4
+ gem 'activesupport', "~> #{activesupport}.0"
5
+
6
+ gem 'activejob', "~> #{activesupport}.0" if activesupport >= '4.2'
6
7
  gem 'resque', require: false
8
+ gem 'shoryuken', require: false
9
+ gem 'aws-sdk-sqs', require: false
7
10
  gem 'sidekiq', require: false
8
- end
9
-
10
- appraise "rails.#{version}.activerecord.kaminari" do
11
- gem 'activerecord', "~> #{version}.0"
12
- gem 'activesupport', "~> #{version}.0"
13
- gem 'activejob', "~> #{version}.0" if version >= '4.2'
14
- gem 'kaminari', '0.16.3', require: false
15
- end
16
11
 
17
- appraise "rails.#{version}.activerecord.will_paginate" do
18
- gem 'activerecord', "~> #{version}.0"
19
- gem 'activesupport', "~> #{version}.0"
20
- gem 'activejob', "~> #{version}.0" if version >= '4.2'
12
+ gem 'kaminari', '~> 0.17.0', require: false
21
13
  gem 'will_paginate', require: false
14
+
15
+ gem 'parallel', require: false
22
16
  end
23
17
  end
24
18
 
25
- { '4.0' => '4.2', '5.1' => '4.2' }.each do |(mongoid, activesupport)|
26
- appraise "rails.#{activesupport}.mongoid.#{mongoid}" do
27
- gem 'mongoid', "~> #{mongoid}.0"
19
+ %w[5.0 5.1 5.2].each do |activesupport|
20
+ appraise "rails.#{activesupport}.activerecord" do
21
+ gem 'activerecord', "~> #{activesupport}.0"
28
22
  gem 'activesupport', "~> #{activesupport}.0"
23
+
24
+ gem 'activejob', "~> #{activesupport}.0"
29
25
  gem 'resque', require: false
26
+ gem 'shoryuken', require: false
27
+ gem 'aws-sdk-sqs', require: false
30
28
  gem 'sidekiq', require: false
31
- end
32
29
 
33
- appraise "rails.#{activesupport}.mongoid.#{mongoid}.kaminari" do
34
- gem 'mongoid', "~> #{mongoid}.0"
35
- gem 'activesupport', "~> #{activesupport}.0"
36
- gem 'kaminari', '0.16.3', require: false
30
+ gem 'kaminari-core', '~> 1.1.0', require: false
31
+ gem 'will_paginate', require: false
32
+
33
+ gem 'parallel', require: false
37
34
  end
35
+ end
38
36
 
39
- appraise "rails.#{activesupport}.mongoid.#{mongoid}.will_paginate" do
37
+ appraise 'rails.4.2.mongoid.5.2' do
38
+ gem 'mongoid', '~> 5.2.0'
39
+ gem 'activesupport', '~> 4.2.0'
40
+
41
+ gem 'activejob', '~> 4.2.0'
42
+ gem 'resque', require: false
43
+ gem 'shoryuken', require: false
44
+ gem 'aws-sdk-sqs', require: false
45
+ gem 'sidekiq', require: false
46
+
47
+ gem 'kaminari', '~> 0.17.0', require: false
48
+ gem 'will_paginate', require: false
49
+
50
+ gem 'parallel', require: false
51
+ end
52
+
53
+ {'5.0' => '6.1', '5.1' => '6.3'}.each do |activesupport, mongoid|
54
+ appraise "rails.#{activesupport}.mongoid.#{mongoid}" do
40
55
  gem 'mongoid', "~> #{mongoid}.0"
41
56
  gem 'activesupport', "~> #{activesupport}.0"
57
+
58
+ gem 'activejob', "~> #{activesupport}.0"
59
+ gem 'resque', require: false
60
+ gem 'shoryuken', require: false
61
+ gem 'aws-sdk-sqs', require: false
62
+ gem 'sidekiq', require: false
63
+
64
+ gem 'kaminari-core', '~> 1.1.0', require: false
42
65
  gem 'will_paginate', require: false
66
+
67
+ gem 'parallel', require: false
43
68
  end
44
69
  end
45
70
 
46
- %w(4.38).each do |sequel|
71
+ %w[4.45].each do |sequel|
47
72
  appraise "sequel.#{sequel}" do
48
73
  gem 'sequel', "~> #{sequel}.0"
49
- gem 'activesupport', '~> 5.0.0'
74
+ gem 'activesupport', '~> 5.1.0'
75
+
76
+ gem 'kaminari-core', '~> 1.1.0', require: false
77
+ gem 'will_paginate', require: false
78
+
79
+ gem 'parallel', require: false
50
80
  end
51
81
  end
@@ -1,5 +1,146 @@
1
1
  # master
2
2
 
3
+ # Version 5.2.0
4
+
5
+ ## Changes
6
+
7
+ * Add support for Ruby 3 (@lowang, #734)
8
+
9
+ * Correct deprecation warning for Elasticsearch 5.6 to 6: empty query for`_delete_by_query`, delete by alias, `index_already_exists_exception` renaming (@bhacaz, #735)
10
+
11
+ * Update gemspec dependencies for Rails. Update CI gemfiles and matrix to tests against current LTS Rails versions. (@bhacaz, #733)
12
+
13
+ * Tweak some wording and formatting; add a note about compatibility; update copyright; remove broken logo; update the CI badge (@bbatsov)
14
+
15
+ * Update instructions for AWS ElasticSearch (@olancheg, #714)
16
+
17
+ * Fix more ruby 2.7 keyword params deprecation warnings (@aglushkov, #728)
18
+
19
+ * Fixed all deprecation warnings in Ruby 2.7 (@gseddon, #715)
20
+
21
+ * Added Ruby 2.7 to CircleCI config (@mrzasa, #718)
22
+
23
+ * Allow configuration of Active Job queue name (@mrzasa, #707)
24
+
25
+ * Setup CI on CircleCI (@mrzasa, #711)
26
+
27
+ * Fix deprecation warning for contructing new BigDecimal (@AlexVPopov, #710)
28
+
29
+ # Version 5.1.0
30
+
31
+ ## Breaking changes
32
+
33
+ * Add support for multiple indices in request (@pyromaniac, #657)
34
+
35
+ * Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters (@mattzollinhofer, #647)
36
+
37
+ ## Changes
38
+
39
+ * Speed up imports when `bulk_size` is specified (@yahooguntu, #606)
40
+
41
+ * Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions` (@dck, #682)
42
+
43
+ # Version 5.0.0
44
+
45
+ ## Breaking changes
46
+
47
+ * Try to align the gem version with the ElasticSearch version we support
48
+
49
+ * `Chewy.default_field_type` is `text` now.
50
+
51
+ * `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal`
52
+
53
+ * Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields.
54
+
55
+ * Don't underscore suggested index name (@dm1try, #626)
56
+
57
+ ## Changes
58
+
59
+ * `pipeline` import option support (@eManPrague, #598)
60
+
61
+ * Proper Rails check (@nattfodd, #625)
62
+
63
+ * Bypass strategy performance improvements (@DNNX, #623)
64
+
65
+ * Avoid index update calls for empty data (@robertasg, #620)
66
+
67
+ * Do not underscore suggested index name on `Chewy::Index.index_name` call.
68
+
69
+ * It is possible now to call `root` method several times inside a single type definition, the options will be merged. Also, the block isn't required anymore.
70
+
71
+ * Fixed some Sequel deprecation warnings (@arturtr - #565, @matchbookmac - #577)
72
+
73
+ ## Bugfixes
74
+
75
+ * Fixed index settings logic error (@yahooguntu, #593)
76
+
77
+ * Missed check in higlight method (@heartfulbird, #567)
78
+
79
+ # Version 0.10.1
80
+
81
+ ## Changes
82
+
83
+ * Improved parallel worker titles (#558)
84
+
85
+ ## Bugfixes
86
+
87
+ * Fixed request strategy initial debug message (#557)
88
+
89
+ * Fixed will objects paginated array initialization when pagination was not used (#556)
90
+
91
+ * Fixed fields symbol/string value (#555)
92
+
93
+ * Fixed root field value proc (#554)
94
+
95
+ # Version 0.10.0
96
+
97
+ ## Breaking changes
98
+
99
+ * Changed behavior of `Chewy::Index.index_name`, it doesn't cache the values anymore.
100
+
101
+ * Journal interfaces, related code and rake tasks were completely refactored and are not compatible with the previous version.
102
+
103
+ ## Changes
104
+
105
+ * Less noisy strategies logging (@Borzik, #543)
106
+
107
+ * Parallel import and the corresponding rake tasks.
108
+
109
+ * `:shoryuken` async strategy (@josephchoe, #532)
110
+
111
+ * Deprecate `Chewy::Index.build_index_name`.
112
+
113
+ * Rename `Chewy::Index.default_prefix` to `Chewy::Index.prefix`. The old one is deprecated.
114
+
115
+ * Add `Chewy::Type.derivable_name` for consistency.
116
+
117
+ * Rename `Chewy::Index.derivable_index_name` to `Chewy::Index.derivable_name`.
118
+ `Chewy::Index.derivable_index_name` and `Chewy::Type.derivable_index_name` are deprecated.
119
+
120
+ * Use normal YAML loading, for the config, we don't need the safe one.
121
+
122
+ * `default_root_options` option (@barthez, #526)
123
+
124
+ * Partial indexing ability: it is possible to update only specified fields.
125
+
126
+ * New cool `rake chewy:deploy` task.
127
+
128
+ * Selective reset (resets only if necessary): `rake chewy:upgrade`.
129
+
130
+ * Consistency checks and synchronization: `rake chewy:sync`.
131
+
132
+ * Brand new request DSL. Supports ElasticSearch 2 and 5, better usability, architecture and docs.
133
+
134
+ * Add Kaminari 1.0 support.
135
+
136
+ * `skip_index_creation_on_import` option (@sergey-kintsel, #483)
137
+
138
+ * Ability to use procs for settings (@parallel588, #481)
139
+
140
+ * Bulk indexing optimizations with new additional options (@eproulx-petalmd, #467)
141
+
142
+ * Configurable sidekiq options (@averell23, #438)
143
+
3
144
  # Version 0.9.0
4
145
 
5
146
  ## Changes
@@ -14,7 +155,7 @@
14
155
 
15
156
  * Minitest helpers (@robacarp, #396)
16
157
 
17
- * `Chewy::Query#unlimited` to fetch all the records (@sergey-kintsel, #393)
158
+ * `Chewy::Query#unlimited` to fetch all the documents (@sergey-kintsel, #393)
18
159
 
19
160
  * `Chewy::Query#exists?` (@sergey-kintsel, #386)
20
161
 
@@ -84,6 +225,12 @@
84
225
 
85
226
  # Version 0.8.3
86
227
 
228
+ ## Breaking changes:
229
+
230
+ * `Chewy.atomic` and `Chewy.urgent_update=` methods was removed from the codebase, use `Chewy.strategy` block instead.
231
+
232
+ * `delete_from_index?` hook is removed from the codebase.
233
+
87
234
  ## Changes
88
235
 
89
236
  * Sequel support completely reworked to use common ORM implementations + better sequel specs covarage.
@@ -100,12 +247,6 @@
100
247
 
101
248
  * Correct custom assets path silencer (@davekaro)
102
249
 
103
- ## Incompatible changes:
104
-
105
- * `Chewy.atomic` and `Chewy.urgent_update=` methods was removed from the codebase, use `Chewy.strategy` block instead.
106
-
107
- * `delete_from_index?` hook is removed from the codebase.
108
-
109
250
  # Version 0.8.2
110
251
 
111
252
  ## Changes
@@ -141,7 +282,7 @@
141
282
 
142
283
  # Version 0.8.0
143
284
 
144
- ## Incompatible changes:
285
+ ## Breaking changes:
145
286
 
146
287
  * `:atomic` and `:urgent` strategies are using `import!` method raising exceptions
147
288
 
@@ -167,7 +308,7 @@
167
308
 
168
309
  # Version 0.7.0
169
310
 
170
- ## Incompatible changes:
311
+ ## Breaking changes:
171
312
 
172
313
  * `Chewy.use_after_commit_callbacks = false` returns previous RDBMS behavior
173
314
  in tests
@@ -296,7 +437,7 @@
296
437
 
297
438
  * `min_score` query option support (@jshirley)
298
439
 
299
- * `Chewy::Query#find` method for finding records by id
440
+ * `Chewy::Query#find` method for finding documents by id
300
441
 
301
442
  # Version 0.6.0
302
443
 
@@ -316,7 +457,7 @@
316
457
 
317
458
  # Version 0.5.2
318
459
 
319
- ## Incompatible changes:
460
+ ## Breaking changes:
320
461
 
321
462
  * `Chewy::Type::Base` removed in favour of using `Chewy::Type` as a base class for all types
322
463
 
@@ -356,7 +497,7 @@
356
497
 
357
498
  # Version 0.5.0
358
499
 
359
- ## Incompatible changes:
500
+ ## Breaking changes:
360
501
 
361
502
  * 404 exception (IndexMissingException) while query is swallowed and treated like an empty result set.
362
503