algoliasearch-rails 2.0.0 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d738368dd1684b9fa58b5507e65d0d7522930a6894e0e9684139fbd5def1a583
4
- data.tar.gz: 8fdd59e52471fd184cf51092706fb345d699cd9d135385bd0a7ade084ec8dc2d
3
+ metadata.gz: 05d79fea6be33d2b368545b05d61ff20d6c9ebc24c82c6ebce9d101b5dd6c1be
4
+ data.tar.gz: 9d321dcbd147b7f566b520cc2c9f536a505451ede8a654bcb58a39aa68190b4c
5
5
  SHA512:
6
- metadata.gz: a9f4a61d1eafcda6ffbca4c585026ca54d9aed7fb3b03b36143c19b5ee504196b10e2a8be88b7083004fb0b070dfd12bb0dbfecaa987c1761c8afca31326eeea
7
- data.tar.gz: 6a8fb2b05c4798965164fc2f651624b2a69935dfa3a22d7704bb312424b7e0f796e7c3d5e9bbdc6d9058f17fe06cc0ec40bd41ee06233f11ce98435906f2a235
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.0.0...master)
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-x86_64-darwin)
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
- x86_64-darwin-19
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.2.15
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
- <h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Rails project</h4>
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
- <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>
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
 
@@ -9,7 +9,7 @@ module AlgoliaSearch
9
9
  class Kaminari < ::Kaminari::PaginatableArray
10
10
 
11
11
  def initialize(array, options)
12
- super(array, options)
12
+ super(array, **options)
13
13
  end
14
14
 
15
15
  def limit(num)
@@ -1,3 +1,3 @@
1
1
  module AlgoliaSearch
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.3'
3
3
  end
@@ -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')
@@ -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'], :symbolize_keys => false }
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.0.0
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-05-03 00:00:00.000000000 Z
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
- rubyforge_project:
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