algoliasearch-rails 2.0.0 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.MD +18 -1
- data/Gemfile.lock +5 -3
- data/README.md +10 -33
- data/lib/algoliasearch/configuration.rb +2 -1
- data/lib/algoliasearch/pagination/kaminari.rb +1 -1
- data/lib/algoliasearch/version.rb +1 -1
- data/lib/algoliasearch-rails.rb +6 -2
- data/spec/utilities_spec.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d79fea6be33d2b368545b05d61ff20d6c9ebc24c82c6ebce9d101b5dd6c1be
|
4
|
+
data.tar.gz: 9d321dcbd147b7f566b520cc2c9f536a505451ede8a654bcb58a39aa68190b4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c767d7f18c8b3c4262851b76b7a2ce1985b54b0b865ce735f9730f13f0680884965999a055e2b8a20912e9bdc777395100df71639888e38a6c4a315629f5ab
|
7
|
+
data.tar.gz: 3bbe879c074ca6debba2c4966917595f7f530f3c5a625d43958e00e73927495ebf183e711067c3ae2cdef4e7eb89c6b26357dab48ae1bf71a18eac6f07396345
|
data/CHANGELOG.MD
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.
|
3
|
+
## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.1.3...master)
|
4
|
+
|
5
|
+
## [2.1.3](https://github.com/algolia/algoliasearch-rails/compare/2.1.3...2.1.2)
|
6
|
+
### Fixed
|
7
|
+
- Prevent an extra get_settings call even if `check_settings` is false [`#367`](https://github.com/algolia/algoliasearch-rails/pull/367)
|
8
|
+
|
9
|
+
## [2.1.2](https://github.com/algolia/algoliasearch-rails/compare/2.1.2...2.1.1)
|
10
|
+
### Fixed
|
11
|
+
- Error with keys that got symbolized by default [`#403`](https://github.com/algolia/algoliasearch-rails/pull/403)
|
12
|
+
|
13
|
+
## [2.1.1](https://github.com/algolia/algoliasearch-rails/compare/2.1.1...2.1.0)
|
14
|
+
### Fixed
|
15
|
+
- Error with Ruby 3 in regards to default splat behavior [`#400`](https://github.com/algolia/algoliasearch-rails/pull/400)
|
16
|
+
|
17
|
+
## [2.1.0](https://github.com/algolia/algoliasearch-rails/compare/2.1.0...2.0.0)
|
18
|
+
### Added
|
19
|
+
- Add support for [virtual replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/#what-are-virtual-replicas) ([#386](https://github.com/algolia/algoliasearch-rails/pull/386))
|
20
|
+
|
4
21
|
|
5
22
|
## [2.0.0](https://github.com/algolia/algoliasearch-rails/compare/2.0.0...1.25.0)
|
6
23
|
|
data/Gemfile.lock
CHANGED
@@ -112,13 +112,15 @@ GEM
|
|
112
112
|
marcel (1.0.1)
|
113
113
|
method_source (1.0.0)
|
114
114
|
mini_mime (1.0.3)
|
115
|
+
mini_portile2 (2.5.0)
|
115
116
|
minitest (5.14.4)
|
116
117
|
multi_json (1.15.0)
|
117
118
|
multipart-post (2.1.1)
|
118
119
|
net-http-persistent (2.9.4)
|
119
120
|
net-http-pipeline (1.0.1)
|
120
121
|
nio4r (2.5.7)
|
121
|
-
nokogiri (1.11.3
|
122
|
+
nokogiri (1.11.3)
|
123
|
+
mini_portile2 (~> 2.5.0)
|
122
124
|
racc (~> 1.4)
|
123
125
|
pusher-client (0.6.2)
|
124
126
|
json
|
@@ -195,7 +197,7 @@ GEM
|
|
195
197
|
zeitwerk (2.4.2)
|
196
198
|
|
197
199
|
PLATFORMS
|
198
|
-
|
200
|
+
ruby
|
199
201
|
|
200
202
|
DEPENDENCIES
|
201
203
|
active_model_serializers
|
@@ -216,4 +218,4 @@ DEPENDENCIES
|
|
216
218
|
will_paginate (>= 2.3.15)
|
217
219
|
|
218
220
|
BUNDLED WITH
|
219
|
-
2.
|
221
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
<p align="center">
|
2
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"
|
3
|
+
<img alt="Algolia for Rails" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/rails.png"/>
|
4
4
|
</a>
|
5
|
+
</p>
|
5
6
|
|
6
|
-
|
7
|
+
<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
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
</p>
|
9
|
+
<p align="center">
|
10
|
+
<a href="https://circleci.com/gh/algolia/algoliasearch-rails"><img src="https://circleci.com/gh/algolia/algoliasearch-rails.svg?style=shield" alt="CircleCI" /></a>
|
11
|
+
<a href="http://badge.fury.io/rb/algoliasearch-rails"><img src="https://badge.fury.io/rb/algoliasearch-rails.svg" alt="Gem Version"/></a>
|
12
|
+
<a href="https://codeclimate.com/github/algolia/algoliasearch-rails"><img src="https://codeclimate.com/github/algolia/algoliasearch-rails.svg" alt="Code Climate"/></a>
|
13
|
+
<img src="https://img.shields.io/badge/ActiveRecord-yes-blue.svg?style=flat-square" alt="ActiveRecord"/>
|
14
|
+
<img src="https://img.shields.io/badge/Mongoid-yes-blue.svg?style=flat-square" alt="Mongoid"/>
|
15
|
+
<img src="https://img.shields.io/badge/Sequel-yes-blue.svg?style=flat-square" alt="Sequel"/>
|
16
16
|
</p>
|
17
17
|
|
18
18
|
<p align="center">
|
@@ -1160,29 +1160,6 @@ class User < ActiveRecord::Base
|
|
1160
1160
|
end
|
1161
1161
|
```
|
1162
1162
|
|
1163
|
-
Or you may want to mock Algolia's API calls. We provide a [WebMock](https://github.com/bblimke/webmock) sample configuration that you can use including `algolia/webmock`:
|
1164
|
-
|
1165
|
-
```ruby
|
1166
|
-
require 'algolia/webmock'
|
1167
|
-
|
1168
|
-
describe 'With a mocked client' do
|
1169
|
-
|
1170
|
-
before(:each) do
|
1171
|
-
WebMock.enable!
|
1172
|
-
end
|
1173
|
-
|
1174
|
-
it "shouldn't perform any API calls here" do
|
1175
|
-
User.create(name: 'My Indexed User') # mocked, no API call performed
|
1176
|
-
User.search('').should == {} # mocked, no API call performed
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
after(:each) do
|
1180
|
-
WebMock.disable!
|
1181
|
-
end
|
1182
|
-
|
1183
|
-
end
|
1184
|
-
```
|
1185
|
-
|
1186
1163
|
|
1187
1164
|
## ❓ Troubleshooting
|
1188
1165
|
|
@@ -10,7 +10,8 @@ module AlgoliaSearch
|
|
10
10
|
|
11
11
|
def configuration=(configuration)
|
12
12
|
@@configuration = configuration.merge(
|
13
|
-
:user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION::STRING})"
|
13
|
+
:user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION::STRING})",
|
14
|
+
:symbolize_keys => false
|
14
15
|
)
|
15
16
|
end
|
16
17
|
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -246,10 +246,12 @@ module AlgoliaSearch
|
|
246
246
|
v = get_setting(k)
|
247
247
|
settings[k] = v if !v.nil?
|
248
248
|
end
|
249
|
+
|
249
250
|
if !@options[:replica]
|
250
251
|
settings[:replicas] = additional_indexes.select { |opts, s| opts[:replica] }.map do |opts, s|
|
251
252
|
name = opts[:index_name]
|
252
253
|
name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment]
|
254
|
+
name = "virtual(#{name})" if opts[:virtual]
|
253
255
|
name
|
254
256
|
end
|
255
257
|
settings.delete(:replicas) if settings[:replicas].empty?
|
@@ -784,13 +786,15 @@ module AlgoliaSearch
|
|
784
786
|
|
785
787
|
@algolia_indexes[settings] = SafeIndex.new(algolia_index_name(options), algoliasearch_options[:raise_on_failure])
|
786
788
|
|
787
|
-
current_settings = @algolia_indexes[settings].get_settings(:getVersion => 1) rescue nil # if the index doesn't exist
|
788
|
-
|
789
789
|
index_settings ||= settings.to_settings
|
790
790
|
index_settings = options[:primary_settings].to_settings.merge(index_settings) if options[:inherit]
|
791
791
|
|
792
792
|
options[:check_settings] = true if options[:check_settings].nil?
|
793
793
|
|
794
|
+
current_settings = if options[:check_settings]
|
795
|
+
@algolia_indexes[settings].get_settings(:getVersion => 1) rescue nil # if the index doesn't exist
|
796
|
+
end
|
797
|
+
|
794
798
|
if !algolia_indexing_disabled?(options) && options[:check_settings] && algoliasearch_settings_changed?(current_settings, index_settings)
|
795
799
|
replicas = index_settings.delete(:replicas) ||
|
796
800
|
index_settings.delete('replicas')
|
data/spec/utilities_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
2
2
|
|
3
|
-
AlgoliaSearch.configuration = { :application_id => ENV['ALGOLIA_APPLICATION_ID'], :api_key => ENV['ALGOLIA_API_KEY']
|
3
|
+
AlgoliaSearch.configuration = { :application_id => ENV['ALGOLIA_APPLICATION_ID'], :api_key => ENV['ALGOLIA_API_KEY'] }
|
4
4
|
|
5
5
|
describe AlgoliaSearch::Utilities do
|
6
6
|
|
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: 2.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -182,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
|
186
|
-
rubygems_version: 2.7.6.2
|
185
|
+
rubygems_version: 3.0.6
|
187
186
|
signing_key:
|
188
187
|
specification_version: 4
|
189
188
|
summary: AlgoliaSearch integration to your favorite ORM
|