algoliasearch 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/Gemfile.lock +52 -19
- data/README.md +47 -1
- data/VERSION +1 -1
- data/algoliasearch.gemspec +3 -3
- data/lib/algolia/client.rb +1 -1
- data/lib/algolia/index.rb +5 -1
- metadata +116 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
|
4
|
-
|
5
|
-
SHA512:
|
6
|
-
|
7
|
-
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c145379f798d496330164e5642604b8922cbe13c
|
4
|
+
data.tar.gz: f35c8286d93ff3ddd4cc711e4986de2b0ab94799
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d97e9777527d24920d9083c9a85e0e0226c4711ecf9a9159d54b0436c7f9f6be5796dbca83ddc672aa397eed1002647cfed3ba597876eb4425f3151be515219
|
7
|
+
data.tar.gz: 6770a224524fed3eae61300e24e33bc44c98ce01d84de13dbf048a1b228550edd2c88424764552a1cab17bf3b665514143b7bce1dc8ebe28f73611499394da35
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,67 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.3.
|
5
|
-
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
6
|
+
crack (0.4.1)
|
7
|
+
safe_yaml (~> 0.9.0)
|
6
8
|
curb (0.8.4)
|
7
|
-
diff-lcs (1.
|
8
|
-
|
9
|
-
|
9
|
+
diff-lcs (1.2.4)
|
10
|
+
faraday (0.8.8)
|
11
|
+
multipart-post (~> 1.2.0)
|
12
|
+
git (1.2.6)
|
13
|
+
github_api (0.10.1)
|
14
|
+
addressable
|
15
|
+
faraday (~> 0.8.1)
|
16
|
+
hashie (>= 1.2)
|
17
|
+
multi_json (~> 1.4)
|
18
|
+
nokogiri (~> 1.5.2)
|
19
|
+
oauth2
|
20
|
+
hashie (2.0.5)
|
21
|
+
highline (1.6.19)
|
22
|
+
httpauth (0.2.0)
|
23
|
+
jeweler (1.8.7)
|
24
|
+
builder
|
10
25
|
bundler (~> 1.0)
|
11
26
|
git (>= 1.2.5)
|
27
|
+
github_api (= 0.10.1)
|
28
|
+
highline (>= 1.6.15)
|
29
|
+
nokogiri (= 1.5.10)
|
12
30
|
rake
|
13
31
|
rdoc
|
14
32
|
json (1.8.0)
|
15
|
-
|
16
|
-
|
33
|
+
jwt (0.1.8)
|
34
|
+
multi_json (>= 1.5)
|
35
|
+
multi_json (1.8.0)
|
36
|
+
multi_xml (0.5.5)
|
37
|
+
multipart-post (1.2.0)
|
38
|
+
nokogiri (1.5.10)
|
39
|
+
oauth2 (0.9.2)
|
40
|
+
faraday (~> 0.8)
|
41
|
+
httpauth (~> 0.2)
|
42
|
+
jwt (~> 0.1.4)
|
43
|
+
multi_json (~> 1.0)
|
44
|
+
multi_xml (~> 0.5)
|
45
|
+
rack (~> 1.2)
|
46
|
+
rack (1.5.2)
|
47
|
+
rake (10.1.0)
|
48
|
+
rdoc (4.0.1)
|
17
49
|
json (~> 1.4)
|
18
50
|
redgreen (1.2.2)
|
19
|
-
rspec (2.
|
20
|
-
rspec-core (~> 2.
|
21
|
-
rspec-expectations (~> 2.
|
22
|
-
rspec-mocks (~> 2.
|
23
|
-
rspec-core (2.
|
24
|
-
rspec-expectations (2.
|
25
|
-
diff-lcs (
|
26
|
-
rspec-mocks (2.
|
27
|
-
|
28
|
-
|
29
|
-
|
51
|
+
rspec (2.14.1)
|
52
|
+
rspec-core (~> 2.14.0)
|
53
|
+
rspec-expectations (~> 2.14.0)
|
54
|
+
rspec-mocks (~> 2.14.0)
|
55
|
+
rspec-core (2.14.5)
|
56
|
+
rspec-expectations (2.14.3)
|
57
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
58
|
+
rspec-mocks (2.14.3)
|
59
|
+
safe_yaml (0.9.7)
|
60
|
+
shoulda-context (1.1.5)
|
61
|
+
test-unit (2.5.5)
|
62
|
+
webmock (1.13.0)
|
30
63
|
addressable (>= 2.2.7)
|
31
|
-
crack (>= 0.
|
64
|
+
crack (>= 0.3.2)
|
32
65
|
|
33
66
|
PLATFORMS
|
34
67
|
ruby
|
data/README.md
CHANGED
@@ -24,6 +24,8 @@ Table of Content
|
|
24
24
|
1. [Wait indexing](#wait-indexing)
|
25
25
|
1. [Batch writes](#batch-writes)
|
26
26
|
1. [Security / User API Keys](#security--user-api-keys)
|
27
|
+
1. [Copy or rename an index](#copy-or-rename-an-index)
|
28
|
+
1. [Logs](#logs)
|
27
29
|
|
28
30
|
Setup
|
29
31
|
-------------
|
@@ -100,6 +102,8 @@ You can use the following optional arguments:
|
|
100
102
|
* **prefixAll**: all query words are interpreted as prefixes (default behavior).
|
101
103
|
* **prefixLast**: only the last word is interpreted as a prefix. This option is recommended if you have a lot of content to speedup the processing.
|
102
104
|
* **prefixNone**: no query word is interpreted as a prefix. This option is not recommended.
|
105
|
+
* **numerics**: specify the list of numeric filters you want to apply separated by a comma. The syntax of one filter is `attributeName` followed by `operand` followed by `value`. Supported operands are `<`, `<=`, `=`, `>` and `>=`.
|
106
|
+
You can have multiple conditions on one attribute like for example `numerics=price>100,price<1000`.
|
103
107
|
* **tags**: filter the query by a set of tags. You can AND tags by separating them by commas. To OR tags, you must add parentheses. For example, `tags=tag1,(tag2,tag3)` means *tag1 AND (tag2 OR tag3)*.<br/>At indexing, tags should be added in the _tags attribute of objects (for example `{"_tags":["tag1","tag2"]}` )
|
104
108
|
|
105
109
|
```ruby
|
@@ -251,7 +255,7 @@ You can retrieve all settings using the `getSettings` function. The result will
|
|
251
255
|
* **attributesToRetrieve**: (array of strings) default list of attributes to retrieve in objects.
|
252
256
|
* **attributesToHighlight**: (array of strings) default list of attributes to highlight.
|
253
257
|
* **attributesToSnippet**: (array of strings) default list of attributes to snippet alongside the number of words to return (syntax is 'attributeName:nbWords')<br/>By default no snippet is computed.
|
254
|
-
* **attributesToIndex**: (array of strings) the list of fields you want to index.<br/>By default all textual attributes of your objects are indexed, but you should update it to get optimal results.<br/>This parameter has two important uses:
|
258
|
+
* **attributesToIndex**: (array of strings) the list of fields you want to index.<br/>By default all textual and numerical attributes of your objects are indexed, but you should update it to get optimal results.<br/>This parameter has two important uses:
|
255
259
|
* *Limits the attributes to index*.<br/>For example if you store a binary image in base64, you want to store it and be able to retrieve it but you don't want to search in the base64 string.
|
256
260
|
* *Controls part of the ranking*.<br/>Matches in attributes at the beginning of the list will be considered more important than matches in attributes further down the list.
|
257
261
|
* **ranking**: (array of strings) controls the way hits are sorted.<br/>We have six available criteria:
|
@@ -393,3 +397,45 @@ Algolia.delete_user_key("f420238212c54dcfad07ea0aa6d5c45f")
|
|
393
397
|
# Deletes an index specific key
|
394
398
|
index.delete_user_key("71671c38001bf3ac857bc82052485107")
|
395
399
|
```
|
400
|
+
|
401
|
+
Copy or rename an index
|
402
|
+
-------------
|
403
|
+
|
404
|
+
You can easily copy or rename an existing index using the `copy` and `move` commands.
|
405
|
+
**Note**: Move and copy commands overwrite destination index.
|
406
|
+
|
407
|
+
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:
|
408
|
+
1. Import your database in a new index using [batches](#batch-writes). Let's call this new index `MyNewIndex`.
|
409
|
+
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.
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
# Rename MyNewIndex in MyIndex
|
413
|
+
puts Algolia.move_index("MyNewIndex", "MyIndex")
|
414
|
+
# Copy MyNewIndex in MyIndex
|
415
|
+
puts Algolia.copy_index("MyNewIndex", "MyIndex")
|
416
|
+
```
|
417
|
+
|
418
|
+
Logs
|
419
|
+
-------------
|
420
|
+
|
421
|
+
You can retrieve the last logs via this API. Each log entry contains:
|
422
|
+
* Timestamp in ISO-8601 format
|
423
|
+
* Client IP
|
424
|
+
* Request Headers (API-Key is obfuscated)
|
425
|
+
* Request URL
|
426
|
+
* Request method
|
427
|
+
* Request body
|
428
|
+
* Answer HTTP code
|
429
|
+
* Answer body
|
430
|
+
* SHA1 ID of entry
|
431
|
+
|
432
|
+
You can retrieve the logs of your last 1000 API calls and browse them using the offset/length parameters:
|
433
|
+
* ***offset***: Specify the first entry to retrieve (0-based, 0 is the most recent log entry). Default to 0.
|
434
|
+
* ***length***: Specify the maximum number of entries to retrieve starting at offset. Defaults to 10. Maximum allowed value: 1000.
|
435
|
+
|
436
|
+
```ruby
|
437
|
+
# Get last 10 log entries
|
438
|
+
puts Algolia.get_logs.to_json
|
439
|
+
# Get last 100 log entries
|
440
|
+
puts Algolia.get_logs(0, 100).to_json
|
441
|
+
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.1
|
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.1"
|
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-10-02"
|
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 = [
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.homepage = "http://github.com/algolia/algoliasearch-client-ruby"
|
35
35
|
s.licenses = ["MIT"]
|
36
36
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = "2.0.
|
37
|
+
s.rubygems_version = "2.0.3"
|
38
38
|
s.summary = "A simple Ruby client for the algolia.com REST API"
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
data/lib/algolia/client.rb
CHANGED
data/lib/algolia/index.rb
CHANGED
@@ -76,6 +76,10 @@ module Algolia
|
|
76
76
|
# @param args (optional) if set, contains an associative array with query parameters:
|
77
77
|
# - attributes: a string that contains attribute names to retrieve separated by a comma.
|
78
78
|
# By default all attributes are retrieved.
|
79
|
+
# - numerics: specify the list of numeric filters you want to apply separated by a comma.
|
80
|
+
# The syntax of one filter is `attributeName` followed by `operand` followed by `value`.
|
81
|
+
# Supported operands are `<`, `<=`, `=`, `>` and `>=`.
|
82
|
+
# You can have multiple conditions on one attribute like for example `numerics=price>100,price<1000`.
|
79
83
|
# - attributesToHighlight: a string that contains attribute names to highlight separated by a comma.
|
80
84
|
# By default indexed attributes are highlighted.
|
81
85
|
# - attributesToSnippet: a string that contains the names of attributes to snippet alongside the number
|
@@ -238,7 +242,7 @@ module Algolia
|
|
238
242
|
# of words to return (syntax is 'attributeName:nbWords').
|
239
243
|
# By default no snippet is computed.
|
240
244
|
# - attributesToIndex: (array of strings) the list of fields you want to index.
|
241
|
-
# By default all textual attributes of your objects are indexed, but you should update it to get optimal
|
245
|
+
# By default all textual and numerical attributes of your objects are indexed, but you should update it to get optimal
|
242
246
|
# results. This parameter has two important uses:
|
243
247
|
# - Limit the attributes to index.
|
244
248
|
# For example if you store a binary image in base64, you want to store it in the index but you
|
metadata
CHANGED
@@ -1,93 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
15
14
|
name: curb
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
23
20
|
type: :runtime
|
24
|
-
version_requirements: *id001
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: bundler
|
27
21
|
prerelease: false
|
28
|
-
|
29
|
-
requirements:
|
30
|
-
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
31
34
|
type: :development
|
32
|
-
version_requirements: *id003
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: jeweler
|
35
35
|
prerelease: false
|
36
|
-
|
37
|
-
requirements:
|
38
|
-
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jeweler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
39
48
|
type: :development
|
40
|
-
version_requirements: *id004
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: test-unit
|
43
49
|
prerelease: false
|
44
|
-
|
45
|
-
requirements:
|
46
|
-
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
type: :development
|
48
|
-
version_requirements: *id005
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rspec
|
51
63
|
prerelease: false
|
52
|
-
|
53
|
-
requirements:
|
54
|
-
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
55
76
|
type: :development
|
56
|
-
version_requirements: *id006
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: shoulda-context
|
59
77
|
prerelease: false
|
60
|
-
|
61
|
-
requirements:
|
62
|
-
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: shoulda-context
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
63
90
|
type: :development
|
64
|
-
version_requirements: *id007
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: webmock
|
67
91
|
prerelease: false
|
68
|
-
|
69
|
-
requirements:
|
70
|
-
-
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
71
104
|
type: :development
|
72
|
-
version_requirements: *id008
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: redgreen
|
75
105
|
prerelease: false
|
76
|
-
|
77
|
-
requirements:
|
78
|
-
-
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: redgreen
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
79
118
|
type: :development
|
80
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
81
125
|
description: A simple Ruby client for the algolia.com REST API
|
82
126
|
email: contact@algolia.com
|
83
127
|
executables: []
|
84
|
-
|
85
128
|
extensions: []
|
86
|
-
|
87
|
-
extra_rdoc_files:
|
129
|
+
extra_rdoc_files:
|
88
130
|
- LICENSE.txt
|
89
131
|
- README.md
|
90
|
-
files:
|
132
|
+
files:
|
91
133
|
- Gemfile
|
92
134
|
- Gemfile.lock
|
93
135
|
- LICENSE.txt
|
@@ -102,27 +144,27 @@ files:
|
|
102
144
|
- lib/algolia/protocol.rb
|
103
145
|
- lib/algoliasearch.rb
|
104
146
|
homepage: http://github.com/algolia/algoliasearch-client-ruby
|
105
|
-
licenses:
|
147
|
+
licenses:
|
106
148
|
- MIT
|
107
149
|
metadata: {}
|
108
|
-
|
109
150
|
post_install_message:
|
110
151
|
rdoc_options: []
|
111
|
-
|
112
|
-
require_paths:
|
152
|
+
require_paths:
|
113
153
|
- lib
|
114
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
-
|
117
|
-
|
118
|
-
|
119
|
-
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
120
164
|
requirements: []
|
121
|
-
|
122
165
|
rubyforge_project:
|
123
166
|
rubygems_version: 2.0.3
|
124
167
|
signing_key:
|
125
168
|
specification_version: 4
|
126
169
|
summary: A simple Ruby client for the algolia.com REST API
|
127
170
|
test_files: []
|
128
|
-
|