algoliasearch 1.18.5 → 1.19.0
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/Gemfile.lock +1 -1
- data/Rakefile +18 -12
- data/lib/algolia/client.rb +235 -178
- data/lib/algolia/index.rb +276 -175
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +37 -5
- metadata +2 -2
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -1023,15 +1023,28 @@ describe 'Client' do
|
|
1023
1023
|
{ :objectID => 'city', :type => 'synonym', :synonyms => ['San Francisco', 'SF'] },
|
1024
1024
|
{ :objectID => 'street', :type => 'altCorrection1', :word => 'street', :corrections => ['st'] }
|
1025
1025
|
]
|
1026
|
-
@index.search_synonyms('')['
|
1026
|
+
synonyms_search = @index.search_synonyms('')['hits']
|
1027
|
+
synonyms_search.size.should eq(2)
|
1027
1028
|
@index.search('Howard St SF')['nbHits'].should eq(1)
|
1028
1029
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1030
|
+
synonym = @index.get_synonym('city')
|
1031
|
+
synonym['objectID'].should eq('city')
|
1032
|
+
synonym['type'].should eq('synonym')
|
1032
1033
|
|
1033
1034
|
@index.search('Howard Street')['nbHits'].should eq(1)
|
1034
1035
|
|
1036
|
+
synonyms_block = []
|
1037
|
+
synonyms_ret = @index.export_synonyms(1) do |s|
|
1038
|
+
synonyms_block << s
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
s0 = synonyms_search.map { |s| s['objectID'] }.sort
|
1042
|
+
s1 = synonyms_block.map { |s| s['objectID'] }.sort
|
1043
|
+
s2 = synonyms_ret.map { |s| s['objectID'] }.sort
|
1044
|
+
|
1045
|
+
s0.should eq(s1)
|
1046
|
+
s1.should eq(s2)
|
1047
|
+
|
1035
1048
|
@index.delete_synonym! 'city'
|
1036
1049
|
@index.search('Howard Street SF')['nbHits'].should eq(0)
|
1037
1050
|
|
@@ -1064,12 +1077,31 @@ describe 'Client' do
|
|
1064
1077
|
@index.search_rules('')['nbHits'].should eq(0)
|
1065
1078
|
|
1066
1079
|
@index.batch_rules!([rule_1, rule_2])
|
1067
|
-
@index.search_rules('')['
|
1080
|
+
rules_search = @index.search_rules('')['hits']
|
1081
|
+
rules_search.size.should eq(2)
|
1082
|
+
|
1083
|
+
rules_block = []
|
1084
|
+
rules_ret = @index.export_rules(1) do |r|
|
1085
|
+
rules_block << r
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
r0 = rules_search.map { |r| r['objectID'] }.sort
|
1089
|
+
r1 = rules_block.map { |r| r['objectID'] }.sort
|
1090
|
+
r2 = rules_ret.map { |r| r['objectID'] }.sort
|
1091
|
+
|
1092
|
+
r0.should eq(r1)
|
1093
|
+
r1.should eq(r2)
|
1068
1094
|
|
1069
1095
|
@index.clear_rules!
|
1070
1096
|
@index.search_rules('')['nbHits'].should eq(0)
|
1071
1097
|
end
|
1072
1098
|
|
1099
|
+
it "should use request options" do
|
1100
|
+
expect{Algolia.list_indexes}.to_not raise_error
|
1101
|
+
|
1102
|
+
expect{Algolia.list_indexes('headers' => { 'X-Algolia-API-Key' => 'NotExistentAPIKey' })}.to raise_error
|
1103
|
+
end
|
1104
|
+
|
1073
1105
|
context 'DNS timeout' do
|
1074
1106
|
before(:each) do
|
1075
1107
|
@client = Algolia::Client.new :application_id => ENV['ALGOLIA_APPLICATION_ID'], :api_key => ENV['ALGOLIA_API_KEY'],
|
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.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|