algoliasearch 1.1.11 → 1.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -3
- data/algoliasearch.gemspec +2 -2
- data/lib/algolia/index.rb +11 -0
- data/lib/algolia/protocol.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: 82eae7dcf820e44290c0b6afb575fce03699c1ce
|
4
|
+
data.tar.gz: 8a90fe2fc6858c7fdf7714c9aa4e558bbcf39ef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd24dbf3876411d88b2bbe04aa8b321d11c8314cdf6cb0b218db3c82c7cd5cfc5a107181528b28c0babc43f240065a08eb0c9d7634f4ac94daabd0644c44359c
|
7
|
+
data.tar.gz: 050d6f623ba9e0baf51c37389aa2b3a0827556cbd18bb924995d509087a0f688e50be649503f74574a45f4e87dc3bf74a70e15ca81cdf35c5d8448f335980bbc
|
data/README.md
CHANGED
@@ -39,6 +39,7 @@ Table of Content
|
|
39
39
|
1. [Batch writes](#batch-writes)
|
40
40
|
1. [Security / User API Keys](#security--user-api-keys)
|
41
41
|
1. [Copy or rename an index](#copy-or-rename-an-index)
|
42
|
+
1. [Backup / Retrieve all index content](#backup--retrieve-all-index-content)
|
42
43
|
1. [Logs](#logs)
|
43
44
|
|
44
45
|
Setup
|
@@ -97,7 +98,7 @@ puts index.search('jim').to_json
|
|
97
98
|
|
98
99
|
Search
|
99
100
|
-------------
|
100
|
-
> **Opening note:** If you are building a web application, you may be more interested in using our [javascript client](https://github.com/algolia/algoliasearch-client-js) to send queries. It brings two benefits: (i) your users get a better response time by avoiding to go
|
101
|
+
> **Opening note:** If you are building a web application, you may be more interested in using our [javascript client](https://github.com/algolia/algoliasearch-client-js) to send queries. It brings two benefits: (i) your users get a better response time by avoiding to go through your servers, and (ii) it will offload your servers of unnecessary tasks.
|
101
102
|
|
102
103
|
To perform a search, you just need to initialize the index and perform a call to the search function.<br/>
|
103
104
|
You can use the following optional arguments:
|
@@ -261,7 +262,9 @@ You can retrieve all settings using the `getSettings` function. The result will
|
|
261
262
|
* **geo**: sort according to decreassing distance when performing a geo-location based search,
|
262
263
|
* **proximity**: sort according to the proximity of query words in hits,
|
263
264
|
* **attribute**: sort according to the order of attributes defined by attributesToIndex,
|
264
|
-
* **exact**:
|
265
|
+
* **exact**:
|
266
|
+
* if the user query contains one word: sort objects having an attribute that is exactly the query word before others. For example if you search for the "V" TV show, you want to find it with the "V" query and avoid to have all popular TV show starting by the v letter before it.
|
267
|
+
* if the user query contains multiple words: sort according to the number of words that matched exactly (and not as a prefix).
|
265
268
|
* **custom**: sort according to a user defined formula set in **customRanking** attribute.<br/>The standard order is ["typo", "geo", "proximity", "attribute", "exact", "custom"]
|
266
269
|
* **customRanking**: (array of strings) lets you specify part of the ranking.<br/>The syntax of this condition is an array of strings containing attributes prefixed by asc (ascending order) or desc (descending order) operator.
|
267
270
|
For example `"customRanking" => ["desc(population)", "asc(name)"]`
|
@@ -375,6 +378,7 @@ index.list_user_keys
|
|
375
378
|
|
376
379
|
Each key is defined by a set of rights that specify the authorized actions. The different rights are:
|
377
380
|
* **search**: allows to search,
|
381
|
+
* **browse**: allow to retrieve all index content via the browse API,
|
378
382
|
* **addObject**: allows to add/update an object in the index,
|
379
383
|
* **deleteObject**: allows to delete an existing object,
|
380
384
|
* **deleteIndex**: allows to delete index content,
|
@@ -443,6 +447,19 @@ The move command is particularly useful is you want to update a big index atomic
|
|
443
447
|
puts Algolia.move_index("MyNewIndex", "MyIndex")
|
444
448
|
```
|
445
449
|
|
450
|
+
Backup / Retrieve all index content
|
451
|
+
-------------
|
452
|
+
|
453
|
+
You can retrieve all index content for backup purpose of for analytics using the browse method.
|
454
|
+
This method retrieve 1000 objects by API call and support pagination.
|
455
|
+
|
456
|
+
```ruby
|
457
|
+
# Get first page
|
458
|
+
puts index.browse(0);
|
459
|
+
# Get second page
|
460
|
+
puts index.browse(1);
|
461
|
+
```
|
462
|
+
|
446
463
|
Logs
|
447
464
|
-------------
|
448
465
|
|
@@ -466,4 +483,4 @@ You can retrieve the logs of your last 1000 API calls and browse them using the
|
|
466
483
|
puts Algolia.get_logs.to_json
|
467
484
|
# Get last 100 log entries
|
468
485
|
puts Algolia.get_logs(0, 100).to_json
|
469
|
-
```
|
486
|
+
```
|
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.12"
|
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-12-05"
|
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 = [
|
data/lib/algolia/index.rb
CHANGED
@@ -134,6 +134,17 @@ module Algolia
|
|
134
134
|
Algolia.client.get(Protocol.search_uri(name, query, encoded_params))
|
135
135
|
end
|
136
136
|
|
137
|
+
#
|
138
|
+
# Browse all index content
|
139
|
+
#
|
140
|
+
# @param page Pagination parameter used to select the page to retrieve.
|
141
|
+
# Page is zero-based and defaults to 0. Thus, to retrieve the 10th page you need to set page=9
|
142
|
+
# @param hitsPerPage: Pagination parameter used to select the number of hits per page. Defaults to 1000.
|
143
|
+
#
|
144
|
+
def browse(page = 0, hitsPerPage = 1000)
|
145
|
+
Algolia.client.get(Protocol.browse_uri(name, {"page" => page, "hitsPerPage" => hitsPerPage}))
|
146
|
+
end
|
147
|
+
|
137
148
|
#
|
138
149
|
# Get an object from this index
|
139
150
|
#
|
data/lib/algolia/protocol.rb
CHANGED
@@ -61,6 +61,11 @@ module Algolia
|
|
61
61
|
"#{index_uri(index)}?query=#{CGI.escape(query)}&#{params}"
|
62
62
|
end
|
63
63
|
|
64
|
+
def Protocol.browse_uri(index, params = {})
|
65
|
+
params = params.nil? || params.size == 0 ? "" : "?#{to_query(params)}"
|
66
|
+
"#{index_uri(index)}/browse#{params}"
|
67
|
+
end
|
68
|
+
|
64
69
|
def Protocol.partial_object_uri(index, object_id)
|
65
70
|
"#{index_uri(index)}/#{object_id}/partial"
|
66
71
|
end
|
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.12
|
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-12-05 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.3
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: A simple Ruby client for the algolia.com REST API
|