algoliasearch-rails 1.11.3 → 1.11.4

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
  SHA1:
3
- metadata.gz: 5d30fc03ca7d3eff1c03acba69d072d537b05490
4
- data.tar.gz: be2943752a81bec8523b6259d0808703bb280cda
3
+ metadata.gz: 32b3cc39ddb51e1ed05f6d42b0884ec31e45035b
4
+ data.tar.gz: d805300078c543d140d4ceaa9f88bd0159b7bf32
5
5
  SHA512:
6
- metadata.gz: a1789ee695aca9675cf336449c068e7cc7af92da6c5b1a4cca93c05eb443bceb71a77fba39915933e58498dac1e69efc8a845c59b014e253dc1ecd94b40539d3
7
- data.tar.gz: b6989c9492c3594823e6b39ed69600cd0172d88b00e6de30fea0a1ee8737424cd5d5c69a5e7532aeb06b1214f964d1057adf7e17cfe32c67a9242652ed2d9d75
6
+ metadata.gz: a7a62a8f7c79036c0a51ed2bb2416262331abac6245496bb6b7585c849be486976e10a8e69a80c23ddbeaa9481031cf56111b59d43fac4c06046ef023084e2b0
7
+ data.tar.gz: 6703e4e84e65b8400476a0326a53df42d2744f811f495b9a49d01c81c2f54a78d263c74d3d7868ae56a6307dc85c809652c1d78c29ca52e4dc797fc3cd8d6592
data/ChangeLog CHANGED
@@ -1,5 +1,9 @@
1
1
  CHANGELOG
2
2
 
3
+ 2014-10-05 1.11.4
4
+
5
+ * Do not compute the 'slaves' index settings on slaves (breaking the diff between current & configured version)
6
+
3
7
  2014-09-16 1.11.3
4
8
 
5
9
  * While reindexing, fetch the master's settings to setup the temporary index
data/README.md CHANGED
@@ -221,10 +221,35 @@ class Contact < ActiveRecord::Base
221
221
  attribute :full_name do
222
222
  "#{first_name} #{last_name}"
223
223
  end
224
+ add_attribute :full_name2
225
+ end
226
+
227
+ def full_name2
228
+ "#{first_name} #{last_name}"
229
+ end
230
+ end
231
+ ```
232
+
233
+ ***Notes:*** As soon as you use such code to define extra attributes, the gem is not anymore able to detect if the attribute has changed (the code uses Rails's `#{attribute}_changed?` method to detect that). As a consequence, your record will be pushed to the API even if its attributes didn't change. You can work-around this behavior creating a `_changed?` method:
234
+
235
+ ```ruby
236
+ class Contact < ActiveRecord::Base
237
+ include AlgoliaSearch
238
+
239
+ algoliasearch do
240
+ attribute :email
241
+ attribute :full_name do
242
+ "#{first_name} #{last_name}"
243
+ end
244
+ end
245
+
246
+ def full_name_changed?
247
+ first_name_changed? || last_name_changed?
224
248
  end
225
249
  end
226
250
  ```
227
251
 
252
+
228
253
  #### Custom ```objectID```
229
254
 
230
255
  By default, the `objectID` is based on your record's `id`. You can change this behavior specifying the `:id` option (be sure to use a uniq field).
@@ -259,7 +284,25 @@ class Post < ActiveRecord::Base
259
284
  end
260
285
  ```
261
286
 
262
- **Notes:** As soon as you use those constraints, ```deleteObjects``` calls will be performed in order to keep the index synced with the DB (The state-less gem doesn't know if the object don't match your constraints anymore or never matched, so we force DELETE operations, even on never-indexed objects).
287
+ **Notes:** As soon as you use those constraints, ```addObjects``` and ```deleteObjects``` calls will be performed in order to keep the index synced with the DB (The state-less gem doesn't know if the object don't match your constraints anymore or never matched, so we force ADD/DELETE operations to be sent). You can work-around this behavior creating a `_changed?` method:
288
+
289
+ ```ruby
290
+ class Contact < ActiveRecord::Base
291
+ include AlgoliaSearch
292
+
293
+ algoliasearch if: :published do
294
+ end
295
+
296
+ def published
297
+ # true or false
298
+ end
299
+
300
+ def published_changed?
301
+ # return true only if you know that the 'published' state changed
302
+ end
303
+ end
304
+ ```
305
+
263
306
 
264
307
  You can index a subset of your records using either:
265
308
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.11.3
1
+ 1.11.4
@@ -6,11 +6,11 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "algoliasearch-rails"
9
- s.version = "1.11.3"
9
+ s.version = "1.11.4"
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-16"
13
+ s.date = "2014-10-05"
14
14
  s.description = "AlgoliaSearch integration to your favorite ORM"
15
15
  s.email = "contact@algolia.com"
16
16
  s.extra_rdoc_files = [
@@ -152,7 +152,7 @@ module AlgoliaSearch
152
152
  name = options[:index_name]
153
153
  name = "#{name}_#{Rails.env.to_s}" if options[:per_environment]
154
154
  name
155
- end
155
+ end if !@options[:slave]
156
156
  settings
157
157
  end
158
158
 
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.3
4
+ version: 1.11.4
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-16 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json