algoliasearch-rails 1.23.2 → 1.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/{ChangeLog → CHANGELOG.MD} +29 -0
- data/Gemfile +7 -3
- data/Gemfile.lock +56 -56
- data/README.md +35 -7
- data/algoliasearch-rails.gemspec +2 -2
- data/lib/algoliasearch/configuration.rb +1 -1
- data/lib/algoliasearch/pagination/kaminari.rb +1 -1
- data/lib/algoliasearch/utilities.rb +5 -1
- data/lib/algoliasearch/version.rb +1 -1
- data/lib/algoliasearch-rails.rb +9 -7
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7605f49088d6e5dad323c990b8419c9bd61a19189ee875d59a1b3b9c70c350
|
4
|
+
data.tar.gz: 3352a8e76be0c0f1bd25e77a151bec3bb594535effdf4fbe0d6c43c038ade8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab287068f7733e21e9765ee0757c35e1300c5a5a04c227473ad0839935f9eb7d4e1c93a69180605b49f7ebf936bb19029e6c9ecc5e9b431c8b7dcef7c78d7224
|
7
|
+
data.tar.gz: b9e3a0aa8dfbbd213fb02443933407ec74b3a1b2bc0013e90e83171fd06b42d76938bd450fb4fe90e5e39d8d78b6c29cbc70eae2bfc1c5736cf19d09d8a6042e
|
data/.travis.yml
CHANGED
@@ -8,6 +8,7 @@ matrix:
|
|
8
8
|
include:
|
9
9
|
- rvm: 1.8.7
|
10
10
|
env: RAILS_VERSION=3.2.0 SEQUEL_VERSION=4.0
|
11
|
+
dist: trusty
|
11
12
|
- rvm: 1.9.3
|
12
13
|
env: RAILS_VERSION=3.2.0
|
13
14
|
- rvm: 1.9.3
|
@@ -32,8 +33,16 @@ matrix:
|
|
32
33
|
env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
|
33
34
|
- rvm: 2.5.3
|
34
35
|
env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
|
36
|
+
- rvm: 2.5.3
|
37
|
+
env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
|
38
|
+
- rvm: 2.6.0
|
39
|
+
env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
|
35
40
|
- rvm: 2.6.0
|
41
|
+
env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
|
42
|
+
- rvm: 2.7.0
|
36
43
|
env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
|
44
|
+
- rvm: 2.7.0
|
45
|
+
env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
|
37
46
|
|
38
47
|
before_install:
|
39
48
|
- wget http://api-key-dealer.herokuapp.com/clients/algolia-keys && chmod +x algolia-keys
|
data/{ChangeLog → CHANGELOG.MD}
RENAMED
@@ -1,5 +1,34 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/1.26.0...master)
|
4
|
+
|
5
|
+
## [1.26.0](https://github.com/algolia/algoliasearch-rails/compare/1.25.0...1.26.0) (2021-09-03)
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Implement virtual replicas ([#409](https://github.com/algolia/algoliasearch-rails/pull/409))
|
10
|
+
|
11
|
+
## [1.25.0](https://github.com/algolia/algoliasearch-rails/compare/1.24.1...1.25.0) (2020-11-24)
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Pass array argument to geoloc ([#372](https://github.com/algolia/algoliasearch-rails/pull/372))
|
15
|
+
- Containerize the repo ([#391](https://github.com/algolia/algoliasearch-rails/pull/391))
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- Use Zeitwerk for loading models in Rails 6 ([#364](https://github.com/algolia/algoliasearch-rails/pull/364))
|
19
|
+
|
20
|
+
## [1.24.1](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.1) (2020-07-15)
|
21
|
+
|
22
|
+
**Fixed**
|
23
|
+
|
24
|
+
* Fixes ruby warning 'Proc.new is deprecated'
|
25
|
+
|
26
|
+
## [1.24.0](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.0) (2020-02-21)
|
27
|
+
|
28
|
+
**Added**
|
29
|
+
|
30
|
+
* Adds indexLanguages in index settings
|
31
|
+
|
3
32
|
## [1.23.2](https://github.com/algolia/algoliasearch-rails/releases/tag/1.23.2) (2019-06-26)
|
4
33
|
|
5
34
|
**Fixed**
|
data/Gemfile
CHANGED
@@ -8,8 +8,8 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
|
8
8
|
end
|
9
9
|
|
10
10
|
group :test do
|
11
|
-
rails_version = ENV["RAILS_VERSION"]
|
12
|
-
gem 'rails', rails_version
|
11
|
+
rails_version = ENV["RAILS_VERSION"] || '5.2'
|
12
|
+
gem 'rails', "~> #{rails_version}"
|
13
13
|
gem 'active_model_serializers'
|
14
14
|
if defined?(RUBY_VERSION) && RUBY_VERSION == "1.8.7"
|
15
15
|
gem 'i18n', '< 0.7'
|
@@ -34,8 +34,12 @@ group :test do
|
|
34
34
|
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
|
35
35
|
gem 'net-http-persistent', '< 3.0'
|
36
36
|
end
|
37
|
+
if Gem::Version.new(rails_version) >= Gem::Version.new('6.0')
|
38
|
+
gem 'sqlite3', '~> 1.4.0', :platform => [:rbx, :ruby]
|
39
|
+
else
|
40
|
+
gem 'sqlite3', '< 1.4.0', :platform => [:rbx, :ruby]
|
41
|
+
end
|
37
42
|
gem 'rspec', '>= 2.5.0', '< 3.0'
|
38
|
-
gem 'sqlite3', '< 1.4.0', :platform => [:rbx, :ruby]
|
39
43
|
gem 'jdbc-sqlite3', :platform => :jruby
|
40
44
|
gem 'activerecord-jdbc-adapter', :platform => :jruby
|
41
45
|
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
data/Gemfile.lock
CHANGED
@@ -1,72 +1,72 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actioncable (5.2.
|
5
|
-
actionpack (= 5.2.
|
4
|
+
actioncable (5.2.2)
|
5
|
+
actionpack (= 5.2.2)
|
6
6
|
nio4r (~> 2.0)
|
7
7
|
websocket-driver (>= 0.6.1)
|
8
|
-
actionmailer (5.2.
|
9
|
-
actionpack (= 5.2.
|
10
|
-
actionview (= 5.2.
|
11
|
-
activejob (= 5.2.
|
8
|
+
actionmailer (5.2.2)
|
9
|
+
actionpack (= 5.2.2)
|
10
|
+
actionview (= 5.2.2)
|
11
|
+
activejob (= 5.2.2)
|
12
12
|
mail (~> 2.5, >= 2.5.4)
|
13
13
|
rails-dom-testing (~> 2.0)
|
14
|
-
actionpack (5.2.
|
15
|
-
actionview (= 5.2.
|
16
|
-
activesupport (= 5.2.
|
14
|
+
actionpack (5.2.2)
|
15
|
+
actionview (= 5.2.2)
|
16
|
+
activesupport (= 5.2.2)
|
17
17
|
rack (~> 2.0)
|
18
18
|
rack-test (>= 0.6.3)
|
19
19
|
rails-dom-testing (~> 2.0)
|
20
20
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
21
|
-
actionview (5.2.
|
22
|
-
activesupport (= 5.2.
|
21
|
+
actionview (5.2.2)
|
22
|
+
activesupport (= 5.2.2)
|
23
23
|
builder (~> 3.1)
|
24
24
|
erubi (~> 1.4)
|
25
25
|
rails-dom-testing (~> 2.0)
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
27
|
-
active_model_serializers (0.10.
|
27
|
+
active_model_serializers (0.10.8)
|
28
28
|
actionpack (>= 4.1, < 6)
|
29
29
|
activemodel (>= 4.1, < 6)
|
30
30
|
case_transform (>= 0.2)
|
31
31
|
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
32
|
-
activejob (5.2.
|
33
|
-
activesupport (= 5.2.
|
32
|
+
activejob (5.2.2)
|
33
|
+
activesupport (= 5.2.2)
|
34
34
|
globalid (>= 0.3.6)
|
35
|
-
activemodel (5.2.
|
36
|
-
activesupport (= 5.2.
|
37
|
-
activerecord (5.2.
|
38
|
-
activemodel (= 5.2.
|
39
|
-
activesupport (= 5.2.
|
35
|
+
activemodel (5.2.2)
|
36
|
+
activesupport (= 5.2.2)
|
37
|
+
activerecord (5.2.2)
|
38
|
+
activemodel (= 5.2.2)
|
39
|
+
activesupport (= 5.2.2)
|
40
40
|
arel (>= 9.0)
|
41
|
-
activestorage (5.2.
|
42
|
-
actionpack (= 5.2.
|
43
|
-
activerecord (= 5.2.
|
41
|
+
activestorage (5.2.2)
|
42
|
+
actionpack (= 5.2.2)
|
43
|
+
activerecord (= 5.2.2)
|
44
44
|
marcel (~> 0.3.1)
|
45
|
-
activesupport (5.2.
|
45
|
+
activesupport (5.2.2)
|
46
46
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
47
47
|
i18n (>= 0.7, < 2)
|
48
48
|
minitest (~> 5.1)
|
49
49
|
tzinfo (~> 1.1)
|
50
50
|
addressable (2.4.0)
|
51
|
-
algoliasearch (1.
|
51
|
+
algoliasearch (1.27.4)
|
52
52
|
httpclient (~> 2.8, >= 2.8.3)
|
53
53
|
json (>= 1.5.1)
|
54
54
|
arel (9.0.0)
|
55
|
-
backports (3.
|
55
|
+
backports (3.11.4)
|
56
56
|
builder (3.2.3)
|
57
57
|
case_transform (0.2)
|
58
58
|
activesupport
|
59
|
-
concurrent-ruby (1.1.
|
59
|
+
concurrent-ruby (1.1.4)
|
60
60
|
crass (1.0.4)
|
61
61
|
diff-lcs (1.3)
|
62
62
|
erubi (1.8.0)
|
63
|
-
ethon (0.
|
63
|
+
ethon (0.11.0)
|
64
64
|
ffi (>= 1.3.0)
|
65
65
|
faraday (0.15.4)
|
66
66
|
multipart-post (>= 1.2, < 3)
|
67
|
-
faraday_middleware (0.
|
67
|
+
faraday_middleware (0.12.2)
|
68
68
|
faraday (>= 0.7.4, < 1.0)
|
69
|
-
ffi (1.
|
69
|
+
ffi (1.9.25)
|
70
70
|
gh (0.15.1)
|
71
71
|
addressable (~> 2.4.0)
|
72
72
|
backports
|
@@ -74,14 +74,14 @@ GEM
|
|
74
74
|
multi_json (~> 1.0)
|
75
75
|
net-http-persistent (~> 2.9)
|
76
76
|
net-http-pipeline
|
77
|
-
globalid (0.4.
|
77
|
+
globalid (0.4.1)
|
78
78
|
activesupport (>= 4.2.0)
|
79
79
|
highline (1.7.10)
|
80
80
|
httpclient (2.8.3)
|
81
|
-
i18n (1.
|
81
|
+
i18n (1.4.0)
|
82
82
|
concurrent-ruby (~> 1.0)
|
83
83
|
json (1.8.6)
|
84
|
-
jsonapi-renderer (0.2.
|
84
|
+
jsonapi-renderer (0.2.0)
|
85
85
|
kaminari (1.1.1)
|
86
86
|
activesupport (>= 4.1.0)
|
87
87
|
kaminari-actionview (= 1.1.1)
|
@@ -109,39 +109,39 @@ GEM
|
|
109
109
|
mini_portile2 (2.4.0)
|
110
110
|
minitest (5.11.3)
|
111
111
|
multi_json (1.13.1)
|
112
|
-
multipart-post (2.
|
112
|
+
multipart-post (2.0.0)
|
113
113
|
net-http-persistent (2.9.4)
|
114
114
|
net-http-pipeline (1.0.1)
|
115
115
|
nio4r (2.3.1)
|
116
|
-
nokogiri (1.
|
116
|
+
nokogiri (1.9.1)
|
117
117
|
mini_portile2 (~> 2.4.0)
|
118
118
|
pusher-client (0.6.2)
|
119
119
|
json
|
120
120
|
websocket (~> 1.0)
|
121
|
-
rack (2.0.
|
121
|
+
rack (2.0.6)
|
122
122
|
rack-test (1.1.0)
|
123
123
|
rack (>= 1.0, < 3)
|
124
|
-
rails (5.2.
|
125
|
-
actioncable (= 5.2.
|
126
|
-
actionmailer (= 5.2.
|
127
|
-
actionpack (= 5.2.
|
128
|
-
actionview (= 5.2.
|
129
|
-
activejob (= 5.2.
|
130
|
-
activemodel (= 5.2.
|
131
|
-
activerecord (= 5.2.
|
132
|
-
activestorage (= 5.2.
|
133
|
-
activesupport (= 5.2.
|
124
|
+
rails (5.2.2)
|
125
|
+
actioncable (= 5.2.2)
|
126
|
+
actionmailer (= 5.2.2)
|
127
|
+
actionpack (= 5.2.2)
|
128
|
+
actionview (= 5.2.2)
|
129
|
+
activejob (= 5.2.2)
|
130
|
+
activemodel (= 5.2.2)
|
131
|
+
activerecord (= 5.2.2)
|
132
|
+
activestorage (= 5.2.2)
|
133
|
+
activesupport (= 5.2.2)
|
134
134
|
bundler (>= 1.3.0)
|
135
|
-
railties (= 5.2.
|
135
|
+
railties (= 5.2.2)
|
136
136
|
sprockets-rails (>= 2.0.0)
|
137
137
|
rails-dom-testing (2.0.3)
|
138
138
|
activesupport (>= 4.2.0)
|
139
139
|
nokogiri (>= 1.6)
|
140
140
|
rails-html-sanitizer (1.0.4)
|
141
141
|
loofah (~> 2.2, >= 2.2.2)
|
142
|
-
railties (5.2.
|
143
|
-
actionpack (= 5.2.
|
144
|
-
activesupport (= 5.2.
|
142
|
+
railties (5.2.2)
|
143
|
+
actionpack (= 5.2.2)
|
144
|
+
activesupport (= 5.2.2)
|
145
145
|
method_source
|
146
146
|
rake (>= 0.8.7)
|
147
147
|
thor (>= 0.19.0, < 2.0)
|
@@ -156,7 +156,7 @@ GEM
|
|
156
156
|
rspec-expectations (2.99.2)
|
157
157
|
diff-lcs (>= 1.1.3, < 2.0)
|
158
158
|
rspec-mocks (2.99.4)
|
159
|
-
sequel (5.
|
159
|
+
sequel (5.16.0)
|
160
160
|
sprockets (3.7.2)
|
161
161
|
concurrent-ruby (~> 1.0)
|
162
162
|
rack (> 1, < 3)
|
@@ -167,7 +167,7 @@ GEM
|
|
167
167
|
sqlite3 (1.3.13)
|
168
168
|
thor (0.20.3)
|
169
169
|
thread_safe (0.3.6)
|
170
|
-
travis (1.8.
|
170
|
+
travis (1.8.9)
|
171
171
|
backports
|
172
172
|
faraday (~> 0.9)
|
173
173
|
faraday_middleware (~> 0.9, >= 0.9.1)
|
@@ -181,10 +181,10 @@ GEM
|
|
181
181
|
tzinfo (1.2.5)
|
182
182
|
thread_safe (~> 0.1)
|
183
183
|
websocket (1.2.8)
|
184
|
-
websocket-driver (0.7.
|
184
|
+
websocket-driver (0.7.0)
|
185
185
|
websocket-extensions (>= 0.1.0)
|
186
|
-
websocket-extensions (0.1.
|
187
|
-
will_paginate (3.1.
|
186
|
+
websocket-extensions (0.1.3)
|
187
|
+
will_paginate (3.1.6)
|
188
188
|
|
189
189
|
PLATFORMS
|
190
190
|
ruby
|
@@ -197,7 +197,7 @@ DEPENDENCIES
|
|
197
197
|
jdbc-sqlite3
|
198
198
|
json (~> 1.8, >= 1.8.6)
|
199
199
|
kaminari
|
200
|
-
rails (
|
200
|
+
rails (~> 5.2)
|
201
201
|
rake (~> 10.1.0)
|
202
202
|
rdoc
|
203
203
|
redgreen
|
@@ -208,4 +208,4 @@ DEPENDENCIES
|
|
208
208
|
will_paginate (>= 2.3.15)
|
209
209
|
|
210
210
|
BUNDLED WITH
|
211
|
-
|
211
|
+
1.17.2
|
data/README.md
CHANGED
@@ -1,9 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://www.algolia.com">
|
3
|
+
<img alt="Algolia for Rails" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/rails.png" >
|
4
|
+
</a>
|
5
|
+
|
6
|
+
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Rails project</h4>
|
7
|
+
|
8
|
+
<p align="center">
|
9
|
+
<a href="https://circleci.com/gh/algolia/algoliasearch-rails"><img src="https://circleci.com/gh/algolia/algoliasearch-rails.svg?style=shield" alt="CircleCI" /></a>
|
10
|
+
<a href="http://badge.fury.io/rb/algoliasearch-rails"><img src="https://badge.fury.io/rb/algoliasearch-rails.svg" alt="Gem Version"></img></a>
|
11
|
+
<a href="https://codeclimate.com/github/algolia/algoliasearch-rails"><img src="https://codeclimate.com/github/algolia/algoliasearch-rails.svg" alt="Code Climate"></img></a>
|
12
|
+
<img src="https://img.shields.io/badge/ActiveRecord-yes-blue.svg?style=flat-square" alt="ActiveRecord"></img>
|
13
|
+
<img src="https://img.shields.io/badge/Mongoid-yes-blue.svg?style=flat-square" alt="Mongoid"></img>
|
14
|
+
<img src="https://img.shields.io/badge/Sequel-yes-blue.svg?style=flat-square" alt="Sequel"></img>
|
15
|
+
</p>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p align="center">
|
19
|
+
<a href="https://www.algolia.com/doc/framework-integration/rails/getting-started/setup/?language=ruby" target="_blank">Documentation</a> •
|
20
|
+
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
|
21
|
+
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
|
22
|
+
<a href="https://github.com/algolia/algoliasearch-rails/issues" target="_blank">Report a bug</a> •
|
23
|
+
<a href="https://www.algolia.com/doc/framework-integration/rails/troubleshooting/faq/" target="_blank">FAQ</a> •
|
24
|
+
<a href="https://www.algolia.com/support" target="_blank">Support</a>
|
25
|
+
</p>
|
7
26
|
|
8
27
|
|
9
28
|
This gem let you easily integrate the Algolia Search API to your favorite ORM. It's based on the [algoliasearch-client-ruby](https://github.com/algolia/algoliasearch-client-ruby) gem.
|
@@ -64,6 +83,8 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
|
|
64
83
|
1. **[Testing](#testing)**
|
65
84
|
* [Notes](#notes)
|
66
85
|
|
86
|
+
1. **[Troubleshooting](#troubleshooting)**
|
87
|
+
* [Frequently asked questions](#frequently-asked-questions)
|
67
88
|
|
68
89
|
|
69
90
|
|
@@ -142,7 +163,7 @@ class Contact < ActiveRecord::Base
|
|
142
163
|
include AlgoliaSearch
|
143
164
|
|
144
165
|
algoliasearch do
|
145
|
-
|
166
|
+
attributes :first_name, :last_name, :email
|
146
167
|
end
|
147
168
|
end
|
148
169
|
```
|
@@ -1163,4 +1184,11 @@ end
|
|
1163
1184
|
```
|
1164
1185
|
|
1165
1186
|
|
1187
|
+
## ❓ Troubleshooting
|
1188
|
+
|
1189
|
+
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/) where you will find answers for the most common issues and gotchas with the client.
|
1190
|
+
|
1191
|
+
## Use the Dockerfile
|
1192
|
+
|
1193
|
+
If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.MD) to learn more.
|
1166
1194
|
|
data/algoliasearch-rails.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.description = "AlgoliaSearch integration to your favorite ORM"
|
15
15
|
s.email = "contact@algolia.com"
|
16
16
|
s.extra_rdoc_files = [
|
17
|
-
"
|
17
|
+
"CHANGELOG.MD",
|
18
18
|
"LICENSE",
|
19
19
|
"README.md"
|
20
20
|
]
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
".document",
|
23
23
|
".rspec",
|
24
24
|
".travis.yml",
|
25
|
-
"
|
25
|
+
"CHANGELOG.MD",
|
26
26
|
"Gemfile",
|
27
27
|
"Gemfile.lock",
|
28
28
|
"LICENSE",
|
@@ -6,7 +6,7 @@ module AlgoliaSearch
|
|
6
6
|
|
7
7
|
def configuration=(configuration)
|
8
8
|
@@configuration = configuration.merge(
|
9
|
-
:user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION})"
|
9
|
+
:user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION::STRING})"
|
10
10
|
)
|
11
11
|
Algolia.init @@configuration
|
12
12
|
end
|
@@ -2,7 +2,11 @@ module AlgoliaSearch
|
|
2
2
|
module Utilities
|
3
3
|
class << self
|
4
4
|
def get_model_classes
|
5
|
-
|
5
|
+
if Rails.application && defined?(Rails.autoloaders) && Rails.autoloaders.zeitwerk_enabled?
|
6
|
+
Zeitwerk::Loader.eager_load_all
|
7
|
+
elsif Rails.application
|
8
|
+
Rails.application.eager_load!
|
9
|
+
end
|
6
10
|
AlgoliaSearch.instance_variable_get :@included_in
|
7
11
|
end
|
8
12
|
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -68,7 +68,7 @@ module AlgoliaSearch
|
|
68
68
|
:disableTypoToleranceOnAttributes, :disableTypoToleranceOnWords, :separatorsToIndex,
|
69
69
|
# Language
|
70
70
|
:ignorePlurals, :removeStopWords, :camelCaseAttributes, :decompoundedAttributes,
|
71
|
-
:keepDiacriticsOnCharacters, :queryLanguages,
|
71
|
+
:keepDiacriticsOnCharacters, :queryLanguages, :indexLanguages,
|
72
72
|
# Query Rules
|
73
73
|
:enableRules,
|
74
74
|
# Query Strategy
|
@@ -90,9 +90,9 @@ module AlgoliaSearch
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
def initialize(options, block)
|
93
|
+
def initialize(options, &block)
|
94
94
|
@options = options
|
95
|
-
instance_exec(&block) if
|
95
|
+
instance_exec(&block) if block_given?
|
96
96
|
end
|
97
97
|
|
98
98
|
def use_serializer(serializer)
|
@@ -223,10 +223,10 @@ module AlgoliaSearch
|
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
def geoloc(lat_attr, lng_attr)
|
226
|
+
def geoloc(lat_attr = nil, lng_attr = nil, &block)
|
227
227
|
raise ArgumentError.new('Cannot specify additional attributes on a replica index') if @options[:slave] || @options[:replica]
|
228
228
|
add_attribute :_geoloc do |o|
|
229
|
-
{ :lat => o.send(lat_attr).to_f, :lng => o.send(lng_attr).to_f }
|
229
|
+
block_given? ? o.instance_eval(&block) : { :lat => o.send(lat_attr).to_f, :lng => o.send(lng_attr).to_f }
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -252,12 +252,14 @@ module AlgoliaSearch
|
|
252
252
|
settings[:slaves] = additional_indexes.select { |opts, s| opts[:slave] }.map do |opts, s|
|
253
253
|
name = opts[:index_name]
|
254
254
|
name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment]
|
255
|
+
name = "virtual(#{name})" if opts[:virtual]
|
255
256
|
name
|
256
257
|
end
|
257
258
|
settings.delete(:slaves) if settings[:slaves].empty?
|
258
259
|
settings[:replicas] = additional_indexes.select { |opts, s| opts[:replica] }.map do |opts, s|
|
259
260
|
name = opts[:index_name]
|
260
261
|
name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment]
|
262
|
+
name = "virtual(#{name})" if opts[:virtual]
|
261
263
|
name
|
262
264
|
end
|
263
265
|
settings.delete(:replicas) if settings[:replicas].empty?
|
@@ -272,7 +274,7 @@ module AlgoliaSearch
|
|
272
274
|
@additional_indexes ||= {}
|
273
275
|
raise MixedSlavesAndReplicas.new('Cannot mix slaves and replicas in the same configuration (add_slave is deprecated)') if (options[:slave] && @additional_indexes.any? { |opts, _| opts[:replica] }) || (options[:replica] && @additional_indexes.any? { |opts, _| opts[:slave] })
|
274
276
|
options[:index_name] = index_name
|
275
|
-
@additional_indexes[options] = IndexSettings.new(options,
|
277
|
+
@additional_indexes[options] = IndexSettings.new(options, &block)
|
276
278
|
end
|
277
279
|
|
278
280
|
def add_replica(index_name, options = {}, &block)
|
@@ -389,7 +391,7 @@ module AlgoliaSearch
|
|
389
391
|
end
|
390
392
|
|
391
393
|
def algoliasearch(options = {}, &block)
|
392
|
-
self.algoliasearch_settings = IndexSettings.new(options,
|
394
|
+
self.algoliasearch_settings = IndexSettings.new(options, &block)
|
393
395
|
self.algoliasearch_options = { :type => algolia_full_const_get(model_name.to_s), :per_page => algoliasearch_settings.get_setting(:hitsPerPage) || 10, :page => 1 }.merge(options)
|
394
396
|
|
395
397
|
attr_accessor :highlight_result, :snippet_result
|
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.
|
4
|
+
version: 1.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -119,14 +119,14 @@ email: contact@algolia.com
|
|
119
119
|
executables: []
|
120
120
|
extensions: []
|
121
121
|
extra_rdoc_files:
|
122
|
-
-
|
122
|
+
- CHANGELOG.MD
|
123
123
|
- LICENSE
|
124
124
|
- README.md
|
125
125
|
files:
|
126
126
|
- ".document"
|
127
127
|
- ".rspec"
|
128
128
|
- ".travis.yml"
|
129
|
-
-
|
129
|
+
- CHANGELOG.MD
|
130
130
|
- Gemfile
|
131
131
|
- Gemfile.lock
|
132
132
|
- LICENSE
|
@@ -173,7 +173,7 @@ homepage: http://github.com/algolia/algoliasearch-rails
|
|
173
173
|
licenses:
|
174
174
|
- MIT
|
175
175
|
metadata: {}
|
176
|
-
post_install_message:
|
176
|
+
post_install_message:
|
177
177
|
rdoc_options: []
|
178
178
|
require_paths:
|
179
179
|
- lib
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubygems_version: 3.0.3
|
192
|
-
signing_key:
|
192
|
+
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: AlgoliaSearch integration to your favorite ORM
|
195
195
|
test_files: []
|