algoliasearch-rails 1.11.2 → 1.11.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 +4 -4
- data/ChangeLog +4 -0
- data/VERSION +1 -1
- data/algoliasearch-rails.gemspec +2 -2
- data/lib/algoliasearch-rails.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d30fc03ca7d3eff1c03acba69d072d537b05490
|
4
|
+
data.tar.gz: be2943752a81bec8523b6259d0808703bb280cda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1789ee695aca9675cf336449c068e7cc7af92da6c5b1a4cca93c05eb443bceb71a77fba39915933e58498dac1e69efc8a845c59b014e253dc1ecd94b40539d3
|
7
|
+
data.tar.gz: b6989c9492c3594823e6b39ed69600cd0172d88b00e6de30fea0a1ee8737424cd5d5c69a5e7532aeb06b1214f964d1057adf7e17cfe32c67a9242652ed2d9d75
|
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.11.
|
1
|
+
1.11.3
|
data/algoliasearch-rails.gemspec
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "algoliasearch-rails"
|
9
|
-
s.version = "1.11.
|
9
|
+
s.version = "1.11.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Algolia"]
|
13
|
-
s.date = "2014-09-
|
13
|
+
s.date = "2014-09-16"
|
14
14
|
s.description = "AlgoliaSearch integration to your favorite ORM"
|
15
15
|
s.email = "contact@algolia.com"
|
16
16
|
s.extra_rdoc_files = [
|
data/lib/algoliasearch-rails.rb
CHANGED
@@ -257,11 +257,21 @@ module AlgoliaSearch
|
|
257
257
|
algolia_configurations.each do |options, settings|
|
258
258
|
next if algolia_indexing_disabled?(options)
|
259
259
|
next if options[:slave]
|
260
|
-
index_name = algolia_index_name(options)
|
261
260
|
|
261
|
+
# fetch the master settings
|
262
|
+
master_index = algolia_ensure_init(options, settings)
|
263
|
+
master_settings = master_index.get_settings rescue {} # if master doesn't exist yet
|
264
|
+
master_settings.merge!(JSON.parse(settings.to_settings.to_json)) # convert symbols to strings
|
265
|
+
|
266
|
+
# remove the slaves of the temporary index
|
267
|
+
master_settings.delete :slaves
|
268
|
+
master_settings.delete 'slaves'
|
269
|
+
|
270
|
+
# init temporary index
|
271
|
+
index_name = algolia_index_name(options)
|
262
272
|
tmp_options = options.merge({ :index_name => "#{index_name}.tmp" })
|
263
273
|
tmp_settings = settings.dup
|
264
|
-
tmp_index = algolia_ensure_init(tmp_options, tmp_settings,
|
274
|
+
tmp_index = algolia_ensure_init(tmp_options, tmp_settings, master_settings)
|
265
275
|
|
266
276
|
algolia_find_in_batches(batch_size) do |group|
|
267
277
|
if algolia_conditional_index?(tmp_options)
|
@@ -439,19 +449,15 @@ module AlgoliaSearch
|
|
439
449
|
|
440
450
|
protected
|
441
451
|
|
442
|
-
def algolia_ensure_init(options = nil, settings = nil,
|
452
|
+
def algolia_ensure_init(options = nil, settings = nil, index_settings = nil)
|
443
453
|
@algolia_indexes ||= {}
|
444
454
|
options ||= algoliasearch_options
|
445
455
|
settings ||= algoliasearch_settings
|
446
456
|
return @algolia_indexes[settings] if @algolia_indexes[settings]
|
447
457
|
@algolia_indexes[settings] = Algolia::Index.new(algolia_index_name(options))
|
448
458
|
current_settings = @algolia_indexes[settings].get_settings rescue nil # if the index doesn't exist
|
449
|
-
if !algolia_indexing_disabled?(options) && algoliasearch_settings_changed?(current_settings, settings.to_settings)
|
450
|
-
index_settings
|
451
|
-
if remove_slaves
|
452
|
-
index_settings.delete :slaves
|
453
|
-
index_settings.delete 'slaves'
|
454
|
-
end
|
459
|
+
if !algolia_indexing_disabled?(options) && (index_settings || algoliasearch_settings_changed?(current_settings, settings.to_settings))
|
460
|
+
index_settings ||= settings.to_settings
|
455
461
|
@algolia_indexes[settings].set_settings(index_settings)
|
456
462
|
end
|
457
463
|
@algolia_indexes[settings]
|
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.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|