algoliasearch 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/README.md +8 -3
- data/Rakefile +1 -1
- data/algoliasearch.gemspec +3 -3
- data/lib/algolia/client.rb +4 -2
- data/lib/algolia/index.rb +17 -0
- data/lib/algolia/protocol.rb +4 -0
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41cdb9e15fe44adcea0c9c9d2fd06b42284ee323
|
4
|
+
data.tar.gz: c744385715e62c575ca066f3e01c9ac9d9fffa61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49577f70778667287e47dd77691a247c475fd85448562a65d6bb5d457a31bf0966c82a8e48d67cfe2cb8af465b8a3c4089e928aaab58088f37ca66cf83be766b
|
7
|
+
data.tar.gz: 934a7181e7815c046c362bf44f38f37a30d1c12a2a729e2555e62f37f17e64c6d453fe9581989d7db5e213c8ff6f9c0b55349e86f775b963a36faec1ed49a81d
|
data/ChangeLog
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
|
3
|
+
2013-11-07 1.1.6
|
4
|
+
|
5
|
+
* Index: clear and clear! methods can now be used the delete the whole content of an index
|
6
|
+
* User keys: plug new maxQueriesPerIPPerHour and maxHitsPerQuery parameters
|
7
|
+
|
3
8
|
2013-10-17 1.1.5
|
4
9
|
|
5
10
|
* Version is now part of the user-agent
|
data/README.md
CHANGED
@@ -405,15 +405,20 @@ Copy or rename an index
|
|
405
405
|
You can easily copy or rename an existing index using the `copy` and `move` commands.
|
406
406
|
**Note**: Move and copy commands overwrite destination index.
|
407
407
|
|
408
|
+
```ruby
|
409
|
+
# Rename MyIndex in MyIndexNewName
|
410
|
+
puts Algolia.move_index("MyIndex", "MyIndexNewName")
|
411
|
+
# Copy MyIndex in MyIndexCopy
|
412
|
+
puts Algolia.copy_index("MyIndex", "MyIndexCopy")
|
413
|
+
```
|
414
|
+
|
408
415
|
The move command is particularly useful is you want to update a big index atomically from one version to another. For example, if you recreate your index `MyIndex` each night from a database by batch, you just have to:
|
409
416
|
1. Import your database in a new index using [batches](#batch-writes). Let's call this new index `MyNewIndex`.
|
410
417
|
1. Rename `MyNewIndex` in `MyIndex` using the move command. This will automatically override the old index and new queries will be served on the new one.
|
411
418
|
|
412
419
|
```ruby
|
413
|
-
# Rename MyNewIndex in MyIndex
|
420
|
+
# Rename MyNewIndex in MyIndex (and overwrite it)
|
414
421
|
puts Algolia.move_index("MyNewIndex", "MyIndex")
|
415
|
-
# Copy MyNewIndex in MyIndex
|
416
|
-
puts Algolia.copy_index("MyNewIndex", "MyIndex")
|
417
422
|
```
|
418
423
|
|
419
424
|
Logs
|
data/Rakefile
CHANGED
data/algoliasearch.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "algoliasearch"
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Algolia"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-11-07"
|
13
13
|
s.description = "A simple Ruby client for the algolia.com REST API"
|
14
14
|
s.email = "contact@algolia.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.homepage = "http://github.com/algolia/algoliasearch-client-ruby"
|
41
41
|
s.licenses = ["MIT"]
|
42
42
|
s.require_paths = ["lib"]
|
43
|
-
s.rubygems_version = "2.0.
|
43
|
+
s.rubygems_version = "2.0.12"
|
44
44
|
s.summary = "A simple Ruby client for the algolia.com REST API"
|
45
45
|
|
46
46
|
if s.respond_to? :specification_version then
|
data/lib/algolia/client.rb
CHANGED
@@ -175,9 +175,11 @@ module Algolia
|
|
175
175
|
# - settings : allows to get index settings (https only)
|
176
176
|
# - editSettings : allows to change index settings (https only)
|
177
177
|
# @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key)
|
178
|
+
# @param maxQueriesPerIPPerHour the maximum number of API calls allowed from an IP address per hour (0 means unlimited)
|
179
|
+
# @param maxHitsPerQuery the maximum number of hits this API key can retrieve in one call (0 means unlimited)
|
178
180
|
#
|
179
|
-
def Algolia.add_user_key(acls, validity = 0)
|
180
|
-
Algolia.client.post(Protocol.keys_uri, {"acl" => acls, "validity" => validity}.to_json)
|
181
|
+
def Algolia.add_user_key(acls, validity = 0, maxQueriesPerIPPerHour = 0, maxHitsPerQuery = 0)
|
182
|
+
Algolia.client.post(Protocol.keys_uri, {"acl" => acls, "validity" => validity.to_i, "maxQueriesPerIPPerHour" => maxQueriesPerIPPerHour.to_i, "maxHitsPerQuery" => maxHitsPerQuery.to_i}.to_json)
|
181
183
|
end
|
182
184
|
|
183
185
|
# Delete an existing user key
|
data/lib/algolia/index.rb
CHANGED
@@ -231,6 +231,23 @@ module Algolia
|
|
231
231
|
wait_task(res["taskID"])
|
232
232
|
return res
|
233
233
|
end
|
234
|
+
|
235
|
+
#
|
236
|
+
# Delete the index content
|
237
|
+
#
|
238
|
+
#
|
239
|
+
def clear
|
240
|
+
Algolia.client.post(Protocol.clear_uri(name), nil)
|
241
|
+
end
|
242
|
+
|
243
|
+
#
|
244
|
+
# Delete the index content and wait end of indexing
|
245
|
+
#
|
246
|
+
def clear!
|
247
|
+
res = clear
|
248
|
+
wait_task(res["taskID"])
|
249
|
+
return res
|
250
|
+
end
|
234
251
|
|
235
252
|
#
|
236
253
|
# Set settings for this index
|
data/lib/algolia/protocol.rb
CHANGED
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.0.
|
116
|
+
rubygems_version: 2.0.12
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A simple Ruby client for the algolia.com REST API
|