algoliasearch 1.18.0 → 1.18.1
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 +7 -0
- data/README.md +1 -1
- data/lib/algolia/client.rb +13 -7
- data/lib/algolia/protocol.rb +2 -2
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +26 -0
- 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: c3ea0eae5cab250ee0e56c2a83dd4fd7d485c6dd
|
4
|
+
data.tar.gz: edc9b79dd6758a62a1110408f7333d7314c4300e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b48a84ad99d97269136e40d019975cf67e0a22e9c4c67010deda77bb052b80ed9ccb3480610d50aadac4083aaa086a00326e67efa3b003a538f10a817752ea
|
7
|
+
data.tar.gz: 414727d3b1de492f6e0bb66fe8e1d4b4b2eb3ec223962c9768bb3350c512eb911cbbf3d8e0f91be802cdbced888d176420198a3adc8b0bb5ce8fddf8839512d0
|
data/ChangeLog
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
|
3
|
+
2017-11-15 1.18.1
|
4
|
+
* Fix get_logs always returning type `all` (#244)
|
5
|
+
* New scopes to copy_index method (#243)
|
6
|
+
|
7
|
+
2017-11-02 1.18.0
|
8
|
+
* Allow to reuse the webmocks using `Algolia::WebMock.mock!` (#256)
|
9
|
+
|
3
10
|
2017-10-10 1.17.0
|
4
11
|
* New delete_by method
|
5
12
|
|
data/README.md
CHANGED
@@ -83,7 +83,7 @@ index = Algolia::Index.new("your_index_name")
|
|
83
83
|
|
84
84
|
## Push data
|
85
85
|
|
86
|
-
Without any prior configuration, you can start indexing [500 contacts](https://
|
86
|
+
Without any prior configuration, you can start indexing [500 contacts](https://github.com/algolia/datasets/blob/master/contacts/contacts.json) in the ```contacts``` index using the following code:
|
87
87
|
```ruby
|
88
88
|
index = Algolia::Index.new('contacts')
|
89
89
|
batch = JSON.parse(File.read('contacts.json'))
|
data/lib/algolia/client.rb
CHANGED
@@ -151,9 +151,11 @@ module Algolia
|
|
151
151
|
# Copy an existing index.
|
152
152
|
# @param src_index the name of index to copy.
|
153
153
|
# @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
|
154
|
+
# @param scope the optional list of scopes to copy (all if not specified).
|
154
155
|
#
|
155
|
-
def copy_index(src_index, dst_index)
|
156
|
+
def copy_index(src_index, dst_index, scope = nil)
|
156
157
|
request = {"operation" => "copy", "destination" => dst_index};
|
158
|
+
request["scope"] = scope unless scope.nil?
|
157
159
|
post(Protocol.index_operation_uri(src_index), request.to_json)
|
158
160
|
end
|
159
161
|
|
@@ -161,9 +163,10 @@ module Algolia
|
|
161
163
|
# Copy an existing index and wait until the copy has been processed.
|
162
164
|
# @param src_index the name of index to copy.
|
163
165
|
# @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
|
166
|
+
# @param scope the optional list of scopes to copy (all if not specified).
|
164
167
|
#
|
165
|
-
def copy_index!(src_index, dst_index)
|
166
|
-
res = copy_index(src_index, dst_index)
|
168
|
+
def copy_index!(src_index, dst_index, scope = nil)
|
169
|
+
res = copy_index(src_index, dst_index, scope)
|
167
170
|
init_index(dst_index).wait_task(res['taskID'])
|
168
171
|
res
|
169
172
|
end
|
@@ -185,6 +188,7 @@ module Algolia
|
|
185
188
|
#
|
186
189
|
# @param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry).
|
187
190
|
# @param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.
|
191
|
+
# @param type Optional type of log entries to retrieve ("all", "query", "build" or "error").
|
188
192
|
#
|
189
193
|
def get_logs(offset = 0, length = 10, type = "all")
|
190
194
|
if (type.is_a?(true.class))
|
@@ -557,18 +561,20 @@ module Algolia
|
|
557
561
|
# Copy an existing index.
|
558
562
|
# @param src_index the name of index to copy.
|
559
563
|
# @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
|
564
|
+
# @param scope the optional list of scopes to copy (all if not specified).
|
560
565
|
#
|
561
|
-
def Algolia.copy_index(src_index, dst_index)
|
562
|
-
Algolia.client.copy_index(src_index, dst_index)
|
566
|
+
def Algolia.copy_index(src_index, dst_index, scope = nil)
|
567
|
+
Algolia.client.copy_index(src_index, dst_index, scope)
|
563
568
|
end
|
564
569
|
|
565
570
|
#
|
566
571
|
# Copy an existing index and wait until the copy has been processed.
|
567
572
|
# @param src_index the name of index to copy.
|
568
573
|
# @param dst_index the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
|
574
|
+
# @param scope the optional list of scopes to copy (all if not specified).
|
569
575
|
#
|
570
|
-
def Algolia.copy_index!(src_index, dst_index)
|
571
|
-
Algolia.client.copy_index!(src_index, dst_index)
|
576
|
+
def Algolia.copy_index!(src_index, dst_index, scope = nil)
|
577
|
+
Algolia.client.copy_index!(src_index, dst_index, scope)
|
572
578
|
end
|
573
579
|
|
574
580
|
# Delete an index
|
data/lib/algolia/protocol.rb
CHANGED
@@ -101,8 +101,8 @@ module Algolia
|
|
101
101
|
"#{index_uri(index)}/clear"
|
102
102
|
end
|
103
103
|
|
104
|
-
def Protocol.logs(offset, length,
|
105
|
-
"/#{VERSION}/logs?offset=#{offset}&length=#{length}&
|
104
|
+
def Protocol.logs(offset, length, type)
|
105
|
+
"/#{VERSION}/logs?offset=#{offset}&length=#{length}&type=#{type}"
|
106
106
|
end
|
107
107
|
|
108
108
|
def Protocol.keys_uri
|
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -293,6 +293,31 @@ describe 'Client' do
|
|
293
293
|
index.delete_index!
|
294
294
|
end
|
295
295
|
|
296
|
+
it "should copy parts of the index only" do
|
297
|
+
index = Algolia::Index.new(safe_index_name("àlgol?à"))
|
298
|
+
begin
|
299
|
+
@index.clear_index
|
300
|
+
Algolia.delete_index! index.name
|
301
|
+
rescue
|
302
|
+
# friends_2 does not exist
|
303
|
+
end
|
304
|
+
|
305
|
+
@index.add_object!({:firstname => "Robert"})
|
306
|
+
@index.batch_synonyms! [
|
307
|
+
{ :objectID => 'city', :type => 'synonym', :synonyms => ['San Francisco', 'SF'] },
|
308
|
+
{ :objectID => 'street', :type => 'altCorrection1', :word => 'street', :corrections => ['st'] }
|
309
|
+
]
|
310
|
+
@index.search('')['nbHits'].should eq(1)
|
311
|
+
@index.search_synonyms('')['nbHits'].should eq(2)
|
312
|
+
|
313
|
+
res = Algolia.copy_index!(safe_index_name("àlgol?a"), safe_index_name("àlgol?à"), ["synonyms"])
|
314
|
+
|
315
|
+
@index.delete_index!
|
316
|
+
|
317
|
+
index.search_synonyms('')['nbHits'].should eq(2)
|
318
|
+
index.delete_index!
|
319
|
+
end
|
320
|
+
|
296
321
|
it "should move the index" do
|
297
322
|
@index.clear_index rescue "friends does not exist"
|
298
323
|
index = Algolia::Index.new(safe_index_name("àlgol?à"))
|
@@ -325,6 +350,7 @@ describe 'Client' do
|
|
325
350
|
res = Algolia.get_logs(0, 20, true)
|
326
351
|
|
327
352
|
res['logs'].size.should > 0
|
353
|
+
res['logs'].each { |log| log['answer_code'].should eq("404") }
|
328
354
|
end
|
329
355
|
|
330
356
|
it "should search on multipleIndex" do
|
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.18.
|
4
|
+
version: 1.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|