algoliasearch-rails 1.20.1 → 1.20.2
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/README.md +19 -10
- data/algoliasearch-rails.gemspec +3 -3
- data/lib/algoliasearch-rails.rb +2 -2
- data/lib/algoliasearch/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f68b4809609514c72b5c6b9cada34fb133283b5
|
4
|
+
data.tar.gz: 24eca8722672630c450d232b9f73af68505d0972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4c99dd108a20047b9d084c06af3dda1044fafd1b537ab9fbcf5164b0fc2d89c70be7526944159b2b51f121334a8004f2cb4600b721f7c1b7a7e90b88609c6a
|
7
|
+
data.tar.gz: eaa7f323256c42b7cc3d2c0e5188254db900881d52b593342a8d220dbacf767ae1fe08d42af55424b97b119459633a5fe13237de3d95f68c1422b38a15ceeb16
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
minitest (~> 5.1)
|
40
40
|
tzinfo (~> 1.1)
|
41
41
|
addressable (2.4.0)
|
42
|
-
algoliasearch (1.
|
42
|
+
algoliasearch (1.17.0)
|
43
43
|
httpclient (~> 2.8.3)
|
44
44
|
json (>= 1.5.1)
|
45
45
|
arel (7.1.4)
|
@@ -175,7 +175,7 @@ PLATFORMS
|
|
175
175
|
DEPENDENCIES
|
176
176
|
activerecord-jdbc-adapter
|
177
177
|
activerecord-jdbcsqlite3-adapter
|
178
|
-
algoliasearch (~> 1.
|
178
|
+
algoliasearch (~> 1.17.0)
|
179
179
|
jdbc-sqlite3
|
180
180
|
json (~> 1.8, >= 1.8.6)
|
181
181
|
kaminari
|
@@ -190,4 +190,4 @@ DEPENDENCIES
|
|
190
190
|
will_paginate (>= 2.3.15)
|
191
191
|
|
192
192
|
BUNDLED WITH
|
193
|
-
1.
|
193
|
+
1.16.0
|
data/README.md
CHANGED
@@ -21,6 +21,7 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
|
|
21
21
|
## Table of Contents
|
22
22
|
|
23
23
|
|
24
|
+
|
24
25
|
1. **[Setup](#setup)**
|
25
26
|
|
26
27
|
* [Install](#install)
|
@@ -74,6 +75,9 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
|
|
74
75
|
|
75
76
|
|
76
77
|
|
78
|
+
|
79
|
+
|
80
|
+
|
77
81
|
# Setup
|
78
82
|
|
79
83
|
|
@@ -113,7 +117,7 @@ You can configure a various timeout thresholds by setting the following options
|
|
113
117
|
```ruby
|
114
118
|
AlgoliaSearch.configuration = {
|
115
119
|
application_id: 'YourApplicationID',
|
116
|
-
api_key: 'YourAPIKey'
|
120
|
+
api_key: 'YourAPIKey',
|
117
121
|
connect_timeout: 2,
|
118
122
|
receive_timeout: 30,
|
119
123
|
send_timeout: 30,
|
@@ -124,7 +128,7 @@ AlgoliaSearch.configuration = {
|
|
124
128
|
|
125
129
|
## Notes
|
126
130
|
|
127
|
-
This gem makes
|
131
|
+
This gem makes extensive use of Rails' callbacks to trigger the indexing tasks. If you're using methods bypassing `after_validation`, `before_save` or `after_commit` callbacks, it will not index your changes. For example: `update_attribute` doesn't perform validations checks, to perform validations when updating use `update_attributes`.
|
128
132
|
|
129
133
|
All methods injected by the `AlgoliaSearch` module are prefixed by `algolia_` and aliased to the associated short names if they aren't already defined.
|
130
134
|
|
@@ -135,6 +139,7 @@ Contact.algolia_search("jon doe") # <=> Contact.search("jon doe")
|
|
135
139
|
```
|
136
140
|
|
137
141
|
|
142
|
+
|
138
143
|
# Usage
|
139
144
|
|
140
145
|
|
@@ -300,7 +305,7 @@ end
|
|
300
305
|
|
301
306
|
```ruby
|
302
307
|
# dynamical search parameters
|
303
|
-
p Contact.raw_search(
|
308
|
+
p Contact.raw_search('jon doe', { hitsPerPage: 5, page: 2 })
|
304
309
|
```
|
305
310
|
|
306
311
|
## Backend Pagination
|
@@ -375,7 +380,7 @@ end
|
|
375
380
|
```
|
376
381
|
|
377
382
|
```ruby
|
378
|
-
hits = Contact.search(
|
383
|
+
hits = Contact.search('jon doe', { facets: '*' })
|
379
384
|
p hits # ORM-compliant array of objects
|
380
385
|
p hits.facets # extra method added to retrieve facets
|
381
386
|
p hits.facets['company'] # facet values+count of facet 'company'
|
@@ -383,7 +388,7 @@ p hits.facets['zip_code'] # facet values+count of facet 'zip_code'
|
|
383
388
|
```
|
384
389
|
|
385
390
|
```ruby
|
386
|
-
raw_json = Contact.raw_search(
|
391
|
+
raw_json = Contact.raw_search('jon doe', { facets: '*' })
|
387
392
|
p raw_json['facets']
|
388
393
|
```
|
389
394
|
|
@@ -409,7 +414,7 @@ Product.search_for_facet_values('category', 'phone', {
|
|
409
414
|
## Group by
|
410
415
|
|
411
416
|
More info on distinct for grouping can be found
|
412
|
-
[here](https://www.algolia.com/doc/guides/
|
417
|
+
[here](https://www.algolia.com/doc/guides/ranking/distinct/).
|
413
418
|
|
414
419
|
```ruby
|
415
420
|
class Contact < ActiveRecord::Base
|
@@ -442,6 +447,7 @@ end
|
|
442
447
|
At query time, specify <code>{ aroundLatLng: "37.33, -121.89", aroundRadius: 50000 }</code> as search parameters to restrict the result set to 50KM around San Jose.
|
443
448
|
|
444
449
|
|
450
|
+
|
445
451
|
# Options
|
446
452
|
|
447
453
|
|
@@ -857,6 +863,7 @@ end
|
|
857
863
|
```
|
858
864
|
|
859
865
|
|
866
|
+
|
860
867
|
# Indices
|
861
868
|
|
862
869
|
|
@@ -893,6 +900,8 @@ Contact.reindex
|
|
893
900
|
|
894
901
|
**Notes**: if you're using an index-specific API key, ensure you're allowing both `<INDEX_NAME>` and `<INDEX_NAME>.tmp`.
|
895
902
|
|
903
|
+
**Warning:** You should not use such an atomic reindexing operation while scoping/filtering the model because this operation **replaces the entire index**, keeping the filtered objects only. ie: Don't do `MyModel.where(...).reindex` but do `MyModel.where(...).reindex!` (with the trailing `!`)!!!
|
904
|
+
|
896
905
|
### Regular reindexing
|
897
906
|
|
898
907
|
To reindex all your objects in place (without temporary index and therefore without deleting removed objects), use the `reindex!` class method:
|
@@ -1036,13 +1045,14 @@ Book.search 'foo bar', index: 'Book_by_editor'
|
|
1036
1045
|
```
|
1037
1046
|
|
1038
1047
|
|
1048
|
+
|
1039
1049
|
# Testing
|
1040
1050
|
|
1041
1051
|
|
1042
1052
|
|
1043
1053
|
## Notes
|
1044
1054
|
|
1045
|
-
To run the specs, please set the <code>ALGOLIA_APPLICATION_ID</code> and <code>ALGOLIA_API_KEY</code> environment variables. Since the tests are creating and removing
|
1055
|
+
To run the specs, please set the <code>ALGOLIA_APPLICATION_ID</code> and <code>ALGOLIA_API_KEY</code> environment variables. Since the tests are creating and removing indices, DO NOT use your production account.
|
1046
1056
|
|
1047
1057
|
You may want to disable all indexing (add, update & delete operations) API calls, you can set the `disable_indexing` option:
|
1048
1058
|
|
@@ -1050,14 +1060,14 @@ You may want to disable all indexing (add, update & delete operations) API calls
|
|
1050
1060
|
class User < ActiveRecord::Base
|
1051
1061
|
include AlgoliaSearch
|
1052
1062
|
|
1053
|
-
algoliasearch :
|
1063
|
+
algoliasearch per_environment: true, disable_indexing: Rails.env.test? do
|
1054
1064
|
end
|
1055
1065
|
end
|
1056
1066
|
|
1057
1067
|
class User < ActiveRecord::Base
|
1058
1068
|
include AlgoliaSearch
|
1059
1069
|
|
1060
|
-
algoliasearch :
|
1070
|
+
algoliasearch per_environment: true, disable_indexing: Proc.new { Rails.env.test? || more_complex_condition } do
|
1061
1071
|
end
|
1062
1072
|
end
|
1063
1073
|
```
|
@@ -1086,4 +1096,3 @@ end
|
|
1086
1096
|
```
|
1087
1097
|
|
1088
1098
|
|
1089
|
-
|
data/algoliasearch-rails.gemspec
CHANGED
@@ -77,7 +77,7 @@ Gem::Specification.new do |s|
|
|
77
77
|
|
78
78
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
79
79
|
s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
|
80
|
-
s.add_runtime_dependency(%q<algoliasearch>, ["~> 1.
|
80
|
+
s.add_runtime_dependency(%q<algoliasearch>, ["~> 1.17.0"])
|
81
81
|
s.add_development_dependency(%q<will_paginate>, [">= 2.3.15"])
|
82
82
|
s.add_development_dependency(%q<kaminari>, [">= 0"])
|
83
83
|
s.add_development_dependency "travis"
|
@@ -85,11 +85,11 @@ Gem::Specification.new do |s|
|
|
85
85
|
s.add_development_dependency "rdoc"
|
86
86
|
else
|
87
87
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
88
|
-
s.add_dependency(%q<algoliasearch>, ["~> 1.
|
88
|
+
s.add_dependency(%q<algoliasearch>, ["~> 1.17.0"])
|
89
89
|
end
|
90
90
|
else
|
91
91
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
92
|
-
s.add_dependency(%q<algoliasearch>, ["~> 1.
|
92
|
+
s.add_dependency(%q<algoliasearch>, ["~> 1.17.0"])
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -745,12 +745,12 @@ module AlgoliaSearch
|
|
745
745
|
|
746
746
|
@algolia_indexes[settings] = SafeIndex.new(algolia_index_name(options), algoliasearch_options[:raise_on_failure])
|
747
747
|
|
748
|
-
current_settings = @algolia_indexes[settings].get_settings rescue nil # if the index doesn't exist
|
748
|
+
current_settings = @algolia_indexes[settings].get_settings(:getVersion => 1) rescue nil # if the index doesn't exist
|
749
749
|
|
750
750
|
index_settings ||= settings.to_settings
|
751
751
|
index_settings = options[:primary_settings].to_settings.merge(index_settings) if options[:inherit]
|
752
752
|
|
753
|
-
if !algolia_indexing_disabled?(options) &&
|
753
|
+
if !algolia_indexing_disabled?(options) && algoliasearch_settings_changed?(current_settings, index_settings)
|
754
754
|
used_slaves = !current_settings.nil? && !current_settings['slaves'].nil?
|
755
755
|
replicas = index_settings.delete(:replicas) ||
|
756
756
|
index_settings.delete('replicas') ||
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.20.
|
4
|
+
version: 1.20.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.17.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.17.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: will_paginate
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.6.
|
186
|
+
rubygems_version: 2.6.13
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: AlgoliaSearch integration to your favorite ORM
|