algoliasearch 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1035690a7833a5235345419a3376a771932d281e
4
- data.tar.gz: d7eb3c02b159845109c25b7e49b61191e72a2d2d
3
+ metadata.gz: 9aa3ec8a147ae10740f99b9f04eb82cd49b8731b
4
+ data.tar.gz: 9fe92762186104bb95e67f43be839694bfe40cb4
5
5
  SHA512:
6
- metadata.gz: 57f1c99c147f759f6c6a70ecae88b30ec607ab886d720fcc426bf47b1a528028494b54d2edbfd40eb2e560074866b6453fd5727e117ecb9e26abe98ec14f91b3
7
- data.tar.gz: b19a6880521c58d9fd74a4b62244b61aeb348b7f61c06aaf6d90e0565681c4daf2cb5f16d4fa8bcec60a3c2d9762b0d521ac12e742715f7028d56b2589b942f0
6
+ metadata.gz: 1ab1dae58906b5d01180379396e3ee00cd1c67a755a0ebfd29945f80c10a5813dfc8ccf431e0a6145e6a04108efc613f9aa2b9a0297ed1a6cede28d6de030262
7
+ data.tar.gz: f95d7a77dc2a6bc342985171f5de609c74ea3590a31cb12ab61be817b3d8c781fc5e9721f2540783ebbe1cdad3d82ed5c35538ce7d1a4ebf5810cd956aa0923b
data/ChangeLog CHANGED
@@ -1,5 +1,8 @@
1
1
  CHANGELOG
2
2
 
3
+ 2016-07-11 1.10.0
4
+ * `{get,set}_settings` now take optional custom query parameters
5
+
3
6
  2016-06-17 1.9.0
4
7
  * New synonyms API
5
8
 
data/README.md CHANGED
@@ -554,7 +554,65 @@ You can use the following optional arguments:
554
554
  </div>
555
555
  </td>
556
556
  <td class='client-readme-param-content'>
557
- <p>Remove the stop words from query before executing it. Defaults to false. Contains a list of stop words from 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu). In most use-cases, we don&#39;t recommend enabling this option.</p>
557
+ <p>Remove stop words from the query <strong>before</strong> executing it. Defaults to <code>false</code>. Use a boolean to enable/disable all 41 supported languages and a comma separated list of iso codes of the languages you want to use consider to enable the stopwords removal on a subset of them (select the one you have in your records). In most use-cases, you shouldn&#39;t need to enable this option.</p>
558
+
559
+ <p>List of 41 supported languages with their associated iso code: Arabic=ar, Armenian=hy, Basque=eu, Bengali=bn, Brazilian=pt-br, Bulgarian=bg, Catalan=ca, Chinese=zh, Czech=cs, Danish=da, Dutch=nl, English=en, Finnish=fi, French=fr, Galician=gl, German=de, Greek=el, Hindi=hi, Hungarian=hu, Indonesian=id, Irish=ga, Italian=it, Japanese=ja, Korean=ko, Kurdish=ku, Latvian=lv, Lithuanian=lt, Marathi=mr, Norwegian=no, Persian (Farsi)=fa, Polish=pl, Portugese=pt, Romanian=ro, Russian=ru, Slovak=sk, Spanish=es, Swedish=sv, Thai=th, Turkish=tr, Ukranian=uk, Urdu=ur</p>
560
+
561
+ <p>Stop words removal is applied on query words that are not interpreted as a prefix. The behavior depends of the queryType parameter:</p>
562
+
563
+ <ul>
564
+ <li><p><code>queryType=prefixLast</code> means the last query word is a prefix and it won’t be considered for stop words removal</p></li>
565
+ <li><p><code>queryType=prefixNone</code> means no query word are prefix, stop words removal will be applied on all query words</p></li>
566
+ <li><p><code>queryType=prefixAll</code> means all query terms are prefix, stop words won’t be removed</p></li>
567
+ </ul>
568
+
569
+ <p>This parameter is useful when you have a query in natural language like “what is a record?”. In this case, before executing the query, we will remove “what”, “is” and “a” in order to just search for “record”. This removal will remove false positive because of stop words, especially when combined with optional words. For most use cases, it is better to not use this feature as people search by keywords on search engines.</p>
570
+
571
+ </td>
572
+ </tr>
573
+
574
+
575
+
576
+ <tr>
577
+ <td valign='top'>
578
+ <div class='client-readme-param-container'>
579
+ <div class='client-readme-param-container-inner'>
580
+ <div class='client-readme-param-name'><code>exactOnSingleWordQuery</code></div>
581
+ <div class="client-readme-param-meta"><div><em>Default: <strong>attribute</strong></em></div></div>
582
+ </div>
583
+ </div>
584
+ </td>
585
+ <td class='client-readme-param-content'>
586
+ <p>This parameter control how the <code>exact</code> ranking criterion is computed when the query contains one word. There is three different values:</p>
587
+
588
+ <ul>
589
+ <li><p><code>none</code>: no exact on single word query</p></li>
590
+ <li><p><code>word</code>: exact set to 1 if the query word is found in the record. The query word needs to have at least 3 chars and not be part of our stop words dictionary</p></li>
591
+ <li><p><code>attribute</code> (default): exact set to 1 if there is an attribute containing a string equals to the query</p></li>
592
+ </ul>
593
+
594
+ </td>
595
+ </tr>
596
+
597
+
598
+
599
+ <tr>
600
+ <td valign='top'>
601
+ <div class='client-readme-param-container'>
602
+ <div class='client-readme-param-container-inner'>
603
+ <div class='client-readme-param-name'><code>alternativesAsExact</code></div>
604
+ <div class="client-readme-param-meta"><div><em>Default: <strong>["ignorePlurals", "singleWordSynonym"]</strong></em></div></div>
605
+ </div>
606
+ </div>
607
+ </td>
608
+ <td class='client-readme-param-content'>
609
+ <p>Specify the list of approximation that should be considered as an exact match in the ranking formula:</p>
610
+
611
+ <ul>
612
+ <li><p><code>ignorePlurals</code>: alternative words added by the ignorePlurals feature</p></li>
613
+ <li><p><code>singleWordSynonym</code>: single-word synonym (For example &quot;NY&quot; = &quot;NYC&quot;)</p></li>
614
+ <li><p><code>multiWordsSynonym</code>: multiple-words synonym (For example &quot;NY&quot; = &quot;New York&quot;)</p></li>
615
+ </ul>
558
616
 
559
617
  </td>
560
618
  </tr>
@@ -817,7 +875,7 @@ You can use the following optional arguments:
817
875
  </div>
818
876
  </td>
819
877
  <td class='client-readme-param-content'>
820
- <p>A string that contains the list of attributes you want to highlight according to the query. Attributes are separated by commas. You can also use a string array encoding (for example <code>[&quot;name&quot;,&quot;address&quot;]</code>). If an attribute has no match for the query, the raw value is returned. By default, all indexed attributes are highlighted. You can use <code>*</code> if you want to highlight all attributes. A matchLevel is returned for each highlighted attribute and can contain:</p>
878
+ <p>A string that contains the list of attributes you want to highlight according to the query. Attributes are separated by commas. You can also use a string array encoding (for example <code>[&quot;name&quot;,&quot;address&quot;]</code>). If an attribute has no match for the query, the raw value is returned. By default, all indexed attributes are highlighted (as long as they are strings). You can use <code>*</code> if you want to highlight all attributes. A matchLevel is returned for each highlighted attribute and can contain:</p>
821
879
 
822
880
  <ul>
823
881
  <li><strong>full</strong>: If all the query terms were found in the attribute.</li>
@@ -1183,6 +1241,13 @@ puts settings.to_json
1183
1241
  index.set_settings({"customRanking" => ["desc(followers)"]})
1184
1242
  ```
1185
1243
 
1244
+ ## Slave settings
1245
+
1246
+ You can forward all settings updates to the slaves of an index by using the `forwardToSlaves` option:
1247
+
1248
+ ```ruby
1249
+ index.set_settings({"customRanking" => ["desc(followers)"]}, {"forwardToSlave" => true})
1250
+ ```
1186
1251
 
1187
1252
  ## Indexing parameters
1188
1253
 
@@ -1812,12 +1877,68 @@ To get a full description of how the Ranking works, you can have a look at our <
1812
1877
  <div class='client-readme-param-container'>
1813
1878
  <div class='client-readme-param-container-inner'>
1814
1879
  <div class='client-readme-param-name'><code>removeStopWords</code></div>
1815
- <div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1880
+ <div class="client-readme-param-meta"><div><em>Type: <strong>boolean or string array</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1816
1881
  </div>
1817
1882
  </div>
1818
1883
  </td>
1819
1884
  <td class='client-readme-param-content'>
1820
- <p>Remove stop words from query before executing it. Defaults to false. Contains stop words for 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu)</p>
1885
+ <p>Remove stop words from the query <strong>before</strong> executing it. Defaults to <code>false</code>. Use a boolean to enable/disable all 41 supported languages and an array of string listing the iso codes of the languages you want to use consider to enable the stop words removal on a subset of them (select the one you have in your records).</p>
1886
+
1887
+ <p>List of 41 supported languages with their associated iso code: Arabic=ar, Armenian=hy, Basque=eu, Bengali=bn, Brazilian=pt-br, Bulgarian=bg, Catalan=ca, Chinese=zh, Czech=cs, Danish=da, Dutch=nl, English=en, Finnish=fi, French=fr, Galician=gl, German=de, Greek=el, Hindi=hi, Hungarian=hu, Indonesian=id, Irish=ga, Italian=it, Japanese=ja, Korean=ko, Kurdish=ku, Latvian=lv, Lithuanian=lt, Marathi=mr, Norwegian=no, Persian (Farsi)=fa, Polish=pl, Portugese=pt, Romanian=ro, Russian=ru, Slovak=sk, Spanish=es, Swedish=sv, Thai=th, Turkish=tr, Ukranian=uk, Urdu=ur.</p>
1888
+
1889
+ <p>Stop words removal is applied on query words that are not interpreted as a prefix. The behavior depends of the queryType setting:</p>
1890
+
1891
+ <ul>
1892
+ <li><p><code>queryType=prefixLast</code> means the last query word is a prefix and it won’t be considered for stop words removal</p></li>
1893
+ <li><p><code>queryType=prefixNone</code> means no query word are prefix, stop words removal will be applied on all query words</p></li>
1894
+ <li><p><code>queryType=prefixAll</code> means all query terms are prefix, stop words won’t be removed</p></li>
1895
+ </ul>
1896
+
1897
+ <p>This index setting is useful when you have queries in natural language like “what is a record?”. In this case, before executing the query, we will remove “what”, “is” and “a” in order to just search for “record”. This removal will remove false positive because of stop words. For most use cases, it is better to not use this feature as people search by keywords on search engines.</p>
1898
+
1899
+ </td>
1900
+ </tr>
1901
+
1902
+
1903
+ <tr>
1904
+ <td valign='top'>
1905
+ <div class='client-readme-param-container'>
1906
+ <div class='client-readme-param-container-inner'>
1907
+ <div class='client-readme-param-name'><code>exactOnSingleWordQuery</code></div>
1908
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>attribute</strong></em></div></div>
1909
+ </div>
1910
+ </div>
1911
+ </td>
1912
+ <td class='client-readme-param-content'>
1913
+ <p>This parameter controls how the <code>exact</code> ranking criterion is computed when the query contains one word. There is three different values:</p>
1914
+
1915
+ <ul>
1916
+ <li><p><code>none</code>: no <code>exact</code> on single word query</p></li>
1917
+ <li><p><code>word</code>: <code>exact</code> set to 1 if the query word is found in the record. The query word needs to have at least 3 chars and not be part of our stop words dictionary</p></li>
1918
+ <li><p><code>attribute</code> (default): exact set to 1 if there is an attribute containing a string equals to the query</p></li>
1919
+ </ul>
1920
+
1921
+ </td>
1922
+ </tr>
1923
+
1924
+
1925
+ <tr>
1926
+ <td valign='top'>
1927
+ <div class='client-readme-param-container'>
1928
+ <div class='client-readme-param-container-inner'>
1929
+ <div class='client-readme-param-name'><code>alternativesAsExact</code></div>
1930
+ <div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div><div><em>Default: <strong>["ignorePlurals", "singleWordSynonym"]</strong></em></div></div>
1931
+ </div>
1932
+ </div>
1933
+ </td>
1934
+ <td class='client-readme-param-content'>
1935
+ <p>Specify the list of approximation that should be considered as an exact match in the ranking formula:</p>
1936
+
1937
+ <ul>
1938
+ <li><p><code>ignorePlurals</code>: alternative words added by the ignorePlurals feature</p></li>
1939
+ <li><p><code>singleWordSynonym</code>: single-word synonym (For example &quot;NY&quot; = &quot;NYC&quot;)</p></li>
1940
+ <li><p><code>multiWordsSynonym</code>: multiple-words synonym (For example &quot;NY&quot; = &quot;New York&quot;)</p></li>
1941
+ </ul>
1821
1942
 
1822
1943
  </td>
1823
1944
  </tr>
@@ -419,21 +419,22 @@ module Algolia
419
419
  #
420
420
  # Set settings for this index
421
421
  #
422
- def set_settings(new_settings)
423
- client.put(Protocol.settings_uri(name), new_settings.to_json)
422
+ def set_settings(new_settings, options = {})
423
+ client.put(Protocol.settings_uri(name, options), new_settings.to_json)
424
424
  end
425
425
 
426
426
  # Set settings for this index and wait end of indexing
427
427
  #
428
- def set_settings!(new_settings)
429
- res = set_settings(new_settings)
428
+ def set_settings!(new_settings, options = {})
429
+ res = set_settings(new_settings, options)
430
430
  wait_task(res["taskID"])
431
431
  return res
432
432
  end
433
433
 
434
434
  # Get settings of this index
435
- def get_settings
436
- client.get("#{Protocol.settings_uri(name)}?getVersion=2", :read)
435
+ def get_settings(options = {})
436
+ options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']
437
+ client.get("#{Protocol.settings_uri(name, options)}", :read)
437
438
  end
438
439
 
439
440
  # List all existing user keys with their associated ACLs
@@ -88,8 +88,9 @@ module Algolia
88
88
  "#{index_uri(index)}/#{CGI.escape(object_id)}/partial#{params}"
89
89
  end
90
90
 
91
- def Protocol.settings_uri(index)
92
- "#{index_uri(index)}/settings"
91
+ def Protocol.settings_uri(index, params = {})
92
+ params = params.nil? || params.size == 0 ? "" : "?#{to_query(params)}"
93
+ "#{index_uri(index)}/settings#{params}"
93
94
  end
94
95
 
95
96
  def Protocol.clear_uri(index)
@@ -1,3 +1,3 @@
1
1
  module Algolia
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.0"
3
3
  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.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.5.1
134
+ rubygems_version: 2.4.8
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: A simple Ruby client for the algolia.com REST API