searchkick 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e69261f029a233983def6aaec3cd101621807fe8
4
- data.tar.gz: 93d6d5e53193af4ae04537c012845d336a9b7197
3
+ metadata.gz: 2665e44b0bd2b8e4bcceb5d9963acb49505914bb
4
+ data.tar.gz: f44ddcee8dd2b1ff0607aac73243a36a458179c5
5
5
  SHA512:
6
- metadata.gz: 2a2f79b352af2ae191c719480e648e07fc8083e3d6c836632e5f1f5245786386bad8e0397d15f3c13771a7197e92052a9c2ba269de23f3f5858fb528642eff26
7
- data.tar.gz: 57972ac3b439dcbf77bef6d9f121383f93822ae3e3c0b6bbf64baedbe0f46a2dd1dd8c9ded33a0384bb80abb5922a33bd216cdeea9271c25f7dc754fd0f7c5a4
6
+ metadata.gz: ea59d44e55010236af8b16a1c3b1d7e7f160081f137cbdd44e298d291c6ae84a966be25a405f21f970885f07c73bf6e76c6e56edf29cba234c2ba308b6ba5241
7
+ data.tar.gz: 28c80bb3061751507605bebf0a4dacb541a4f8cfd6b98156c3cbfad2aa9de03c916aa12715bc47769a3a79b154d82f4c2bc901d34a7d314e57f2ac0d96fe5ee4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.6
2
+
3
+ - Fixed `Job adapter not found` error
4
+
1
5
  ## 1.3.5
2
6
 
3
7
  - Added support for Elasticsearch 5.0 beta
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  :rocket: Intelligent search made easy
4
4
 
5
- Searchkick learns what **your users** are looking for. As more people search, it gets smarter and the results get better. It’s friendly for developers - and magical for your users.
5
+ Searchkick learns what **your users** are looking for. As more people search, it gets smarter and the results get better. It’s friendly for developers - and magical for your users.
6
6
 
7
7
  Searchkick handles:
8
8
 
@@ -265,7 +265,7 @@ User.search "fresh honey", match: :phrase
265
265
 
266
266
  ### Language
267
267
 
268
- Searchkick defaults to English for stemming. To change this, use:
268
+ Searchkick defaults to English for stemming. To change this, use:
269
269
 
270
270
  ```ruby
271
271
  class Product < ActiveRecord::Base
@@ -366,7 +366,7 @@ class Product < ActiveRecord::Base
366
366
  end
367
367
  ```
368
368
 
369
- Searchkick uses `find_in_batches` to import documents. To eager load associations, use the `search_import` scope.
369
+ Searchkick uses `find_in_batches` to import documents. To eager load associations, use the `search_import` scope.
370
370
 
371
371
  ```ruby
372
372
  class Product < ActiveRecord::Base
@@ -374,10 +374,12 @@ class Product < ActiveRecord::Base
374
374
  end
375
375
  ```
376
376
 
377
- By default, all records are indexed. To control which records are indexed, use the `should_index?` method.
377
+ By default, all records are indexed. To control which records are indexed, use the `should_index?` method together with the `search_import` scope.
378
378
 
379
379
  ```ruby
380
380
  class Product < ActiveRecord::Base
381
+ scope :search_import, -> { where(active: true) }
382
+
381
383
  def should_index?
382
384
  active # only index active records
383
385
  end
@@ -450,7 +452,7 @@ end
450
452
 
451
453
  #### Associations
452
454
 
453
- Data is **not** automatically synced when an association is updated. If this is desired, add a callback to reindex:
455
+ Data is **not** automatically synced when an association is updated. If this is desired, add a callback to reindex:
454
456
 
455
457
  ```ruby
456
458
  class Image < ActiveRecord::Base
@@ -478,11 +480,11 @@ Product.search "apple", track: {user_id: current_user.id}
478
480
 
479
481
  ### Keep Getting Better
480
482
 
481
- Searchkick can use conversion data to learn what users are looking for. If a user searches for “ice cream” and adds Ben & Jerry’s Chunky Monkey to the cart (our conversion metric at Instacart), that item gets a little more weight for similar searches.
483
+ Searchkick can use conversion data to learn what users are looking for. If a user searches for “ice cream” and adds Ben & Jerry’s Chunky Monkey to the cart (our conversion metric at Instacart), that item gets a little more weight for similar searches.
482
484
 
483
- The first step is to define your conversion metric and start tracking conversions. The database works well for low volume, but feel free to use Redis or another datastore.
485
+ The first step is to define your conversion metric and start tracking conversions. The database works well for low volume, but feel free to use Redis or another datastore.
484
486
 
485
- You do **not** need to clean up the search queries. Searchkick automatically treats `apple` and `APPLES` the same.
487
+ You do **not** need to clean up the search queries. Searchkick automatically treats `apple` and `APPLES` the same.
486
488
 
487
489
  Next, add conversions to the index.
488
490
 
@@ -510,7 +512,7 @@ rake searchkick:reindex CLASS=Product
510
512
 
511
513
  ### Personalized Results
512
514
 
513
- Order results differently for each user. For example, show a user’s previously purchased products before other results.
515
+ Order results differently for each user. For example, show a user’s previously purchased products before other results.
514
516
 
515
517
  ```ruby
516
518
  class Product < ActiveRecord::Base
@@ -537,7 +539,7 @@ Autocomplete predicts what a user will type, making the search experience faster
537
539
 
538
540
  **Note:** If you only have a few thousand records, don’t use Searchkick for autocomplete. It’s *much* faster to load all records into JavaScript and autocomplete there (eliminates network requests).
539
541
 
540
- First, specify which fields use this feature. This is necessary since autocomplete can increase the index size significantly, but don’t worry - this gives you blazing faster queries.
542
+ First, specify which fields use this feature. This is necessary since autocomplete can increase the index size significantly, but don’t worry - this gives you blazing faster queries.
541
543
 
542
544
  ```ruby
543
545
  class Book < ActiveRecord::Base
@@ -949,7 +951,7 @@ See the [complete list of analyzers](lib/searchkick/index.rb#L209).
949
951
 
950
952
  ## Deployment
951
953
 
952
- Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This defaults to `http://localhost:9200`.
954
+ Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This defaults to `http://localhost:9200`.
953
955
 
954
956
  ### Heroku
955
957
 
@@ -1376,7 +1378,7 @@ Product.search "ah", misspellings: {prefix_length: 2} # ah, no aha
1376
1378
 
1377
1379
  ## Large Data Sets
1378
1380
 
1379
- For large data sets, check out [Keeping Elasticsearch in Sync](https://www.elastic.co/blog/found-keeping-elasticsearch-in-sync). Searchkick will make this easy in the future.
1381
+ For large data sets, check out [Keeping Elasticsearch in Sync](https://www.elastic.co/blog/found-keeping-elasticsearch-in-sync). Searchkick will make this easy in the future.
1380
1382
 
1381
1383
  ## Testing
1382
1384
 
@@ -1476,7 +1478,7 @@ Before `0.3.0`, locations were indexed incorrectly. When upgrading, be sure to r
1476
1478
 
1477
1479
  ### Inconsistent Scores
1478
1480
 
1479
- Due to the distributed nature of Elasticsearch, you can get incorrect results when the number of documents in the index is low. You can [read more about it here](https://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch). To fix this, do:
1481
+ Due to the distributed nature of Elasticsearch, you can get incorrect results when the number of documents in the index is low. You can [read more about it here](https://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch). To fix this, do:
1480
1482
 
1481
1483
  ```ruby
1482
1484
  class Product < ActiveRecord::Base
@@ -1,3 +1,3 @@
1
1
  module Searchkick
2
- VERSION = "1.3.5"
2
+ VERSION = "1.3.6"
3
3
  end
data/lib/searchkick.rb CHANGED
@@ -12,6 +12,14 @@ require "searchkick/tasks"
12
12
  require "searchkick/middleware"
13
13
  require "searchkick/logging" if defined?(ActiveSupport::Notifications)
14
14
 
15
+ # background jobs
16
+ begin
17
+ require "active_job"
18
+ rescue LoadError
19
+ # do nothing
20
+ end
21
+ require "searchkick/reindex_v2_job" if defined?(ActiveJob)
22
+
15
23
  module Searchkick
16
24
  class Error < StandardError; end
17
25
  class MissingIndexError < Error; end
@@ -152,13 +160,6 @@ module Searchkick
152
160
  end
153
161
  end
154
162
 
155
- ActiveSupport.on_load(:active_job) do
156
- require "searchkick/reindex_v2_job"
157
- end
158
-
159
163
  # TODO find better ActiveModel hook
160
164
  ActiveModel::Callbacks.send(:include, Searchkick::Model)
161
-
162
- ActiveSupport.on_load(:active_record) do
163
- ActiveRecord::Base.send(:extend, Searchkick::Model)
164
- end
165
+ ActiveRecord::Base.send(:extend, Searchkick::Model) if defined?(ActiveRecord)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-28 00:00:00.000000000 Z
11
+ date: 2016-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel