algoliasearch 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/README.md +40 -25
- data/lib/algolia/index.rb +5 -2
- data/lib/algolia/protocol.rb +1 -1
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- 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: 95b3d20c46dcec3d87a58b59208d8b956f69612f
|
4
|
+
data.tar.gz: 8fb785f3f57a5295e30906f2edd265c8d1d126fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2095a59b89eb093a49c33b7b2c3ed6e4e37c5b12f0dc1b29a7df95bdccfb6864502129e518c1761dc5ee6356303502272ca93988997b396479effb07926af946
|
7
|
+
data.tar.gz: c55055efdec8a1cca1c16f9211aa119f81434a589ed1482862b591104787b6a42e66c698f51389fbf628bf513602b48a80fdcebf9ec3a5bbd2fdfb7fa99b49d8
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -314,11 +314,11 @@ The server response will look like:
|
|
314
314
|
|
315
315
|
Hits are made of the JSON objects that you stored in the index; therefore, they are mostly schema-less. However, Algolia does enrich them with a few additional fields:
|
316
316
|
|
317
|
-
- `_highlightResult` (object, optional): Highlighted attributes. *Note: Only returned when [
|
317
|
+
- `_highlightResult` (object, optional): Highlighted attributes. *Note: Only returned when [attributesToHighlight](#attributestohighlight) is non-empty.*
|
318
318
|
|
319
319
|
- `${attribute_name}` (object): Highlighting for one attribute.
|
320
320
|
|
321
|
-
- `value` (string): Markup text with occurrences highlighted. The tags used for highlighting are specified via [
|
321
|
+
- `value` (string): Markup text with occurrences highlighted. The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag).
|
322
322
|
|
323
323
|
- `matchLevel` (string, enum) = {`none` | `partial` | `full`}: Indicates how well the attribute matched the search query.
|
324
324
|
|
@@ -326,15 +326,15 @@ The server response will look like:
|
|
326
326
|
|
327
327
|
- `fullyHighlighted` (boolean): Whether the entire attribute value is highlighted.
|
328
328
|
|
329
|
-
- `_snippetResult` (object, optional): Snippeted attributes. *Note: Only returned when [
|
329
|
+
- `_snippetResult` (object, optional): Snippeted attributes. *Note: Only returned when [attributesToSnippet](#attributestosnippet) is non-empty.*
|
330
330
|
|
331
331
|
- `${attribute_name}` (object): Snippeting for the corresponding attribute.
|
332
332
|
|
333
|
-
- `value` (string): Markup text with occurrences highlighted and optional ellipsis indicators. The tags used for highlighting are specified via [
|
333
|
+
- `value` (string): Markup text with occurrences highlighted and optional ellipsis indicators. The tags used for highlighting are specified via [highlightPreTag](#highlightpretag) and [highlightPostTag](#highlightposttag). The text used to indicate ellipsis is specified via [snippetEllipsisText](#snippetellipsistext).
|
334
334
|
|
335
335
|
- `matchLevel` (string, enum) = {`none` | `partial` | `full`}: Indicates how well the attribute matched the search query.
|
336
336
|
|
337
|
-
- `_rankingInfo` (object, optional): Ranking information. *Note: Only returned when [
|
337
|
+
- `_rankingInfo` (object, optional): Ranking information. *Note: Only returned when [getRankingInfo](#getrankinginfo) is `true`.*
|
338
338
|
|
339
339
|
- `nbTypos` (integer): Number of typos encountered when matching the record. Corresponds to the `typos` ranking criterion in the ranking formula.
|
340
340
|
|
@@ -354,31 +354,33 @@ The server response will look like:
|
|
354
354
|
|
355
355
|
- `filters` (integer): *This field is reserved for advanced usage.* It will be zero in most cases.
|
356
356
|
|
357
|
-
- `_distinctSeqID` (integer): *Note: Only returned when [
|
357
|
+
- `_distinctSeqID` (integer): *Note: Only returned when [distinct](#distinct) is non-zero.* When two consecutive results have the same value for the attribute used for "distinct", this field is used to distinguish between them.
|
358
358
|
|
359
359
|
- `nbHits` (integer): Number of hits that the search query matched.
|
360
360
|
|
361
|
-
- `page` (integer): Index of the current page (zero-based). See the [
|
361
|
+
- `page` (integer): Index of the current page (zero-based). See the [page](#page) search parameter. *Note: Not returned if you use `offset`/`length` for pagination.*
|
362
362
|
|
363
|
-
- `hitsPerPage` (integer): Maximum number of hits returned per page. See the [
|
363
|
+
- `hitsPerPage` (integer): Maximum number of hits returned per page. See the [hitsPerPage](#hitsperpage) search parameter. *Note: Not returned if you use `offset`/`length` for pagination.*
|
364
364
|
|
365
365
|
- `nbPages` (integer): Number of pages corresponding to the number of hits. Basically, `ceil(nbHits / hitsPerPage)`. *Note: Not returned if you use `offset`/`length` for pagination.*
|
366
366
|
|
367
367
|
- `processingTimeMS` (integer): Time that the server took to process the request, in milliseconds. *Note: This does not include network time.*
|
368
368
|
|
369
|
-
- `query` (string): An echo of the query text. See the [
|
369
|
+
- `query` (string): An echo of the query text. See the [query](#query) search parameter.
|
370
370
|
|
371
|
-
- `queryAfterRemoval` (string, optional): *Note: Only returned when [
|
371
|
+
- `queryAfterRemoval` (string, optional): *Note: Only returned when [removeWordsIfNoResults](#removewordsifnoresults) is set to `lastWords` or `firstWords`.* A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. The removed parts are surrounded by `<em>` tags.
|
372
372
|
|
373
373
|
- `params` (string, URL-encoded): An echo of all search parameters.
|
374
374
|
|
375
375
|
- `message` (string, optional): Used to return warnings about the query.
|
376
376
|
|
377
|
-
|
377
|
+
|
378
|
+
- `aroundLatLng` (string, optional): *Note: Only returned when [aroundLatLngViaIP](#aroundlatlngviaip) is set.* The computed geo location. **Warning: for legacy reasons, this parameter is a string and not an object.** Format: `${lat},${lng}`, where the latitude and longitude are expressed as decimal floating point numbers.
|
379
|
+
|
378
380
|
|
379
381
|
- `automaticRadius` (integer, optional): *Note: Only returned for geo queries without an explicitly specified radius (see `aroundRadius`).* The automatically computed radius. **Warning: for legacy reasons, this parameter is a string and not an integer.**
|
380
382
|
|
381
|
-
When [
|
383
|
+
When [getRankingInfo](#getrankinginfo) is set to `true`, the following additional fields are returned:
|
382
384
|
|
383
385
|
- `serverUsed` (string): Actual host name of the server that processed the request. (Our DNS supports automatic failover and load balancing, so this may differ from the host name used in the request.)
|
384
386
|
|
@@ -390,7 +392,7 @@ When [`getRankingInfo`](#getrankinginfo) is set to `true`, the following additio
|
|
390
392
|
|
391
393
|
... and ranking information is also added to each of the hits (see above).
|
392
394
|
|
393
|
-
When [
|
395
|
+
When [facets](#facets) is non-empty, the following additional fields are returned:
|
394
396
|
|
395
397
|
- `facets` (object): Maps each facet name to the corresponding facet counts:
|
396
398
|
|
@@ -410,12 +412,10 @@ When [`facets`](#facets) is non-empty, the following additional fields are retur
|
|
410
412
|
|
411
413
|
- `sum` (integer | float): The sum of all values in the result set.
|
412
414
|
|
413
|
-
- `exhaustiveFacetsCount` (boolean): Whether the counts are exhaustive (`true`) or approximate (`false`). *Note: When using [
|
414
|
-
|
415
|
+
- `exhaustiveFacetsCount` (boolean): Whether the counts are exhaustive (`true`) or approximate (`false`). *Note: When using [distinct](#distinct), the facet counts cannot be exhaustive.*
|
415
416
|
|
416
417
|
### Search Parameters
|
417
418
|
|
418
|
-
<!--PARAMETERS_LINK-->
|
419
419
|
Here is the list of parameters you can use with the search method (`search` [scope](#scope)):
|
420
420
|
Parameters that can also be used in a setSettings also have the `indexing` [scope](#scope)
|
421
421
|
|
@@ -492,8 +492,7 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
|
|
492
492
|
- [synonyms](#synonyms) `search`
|
493
493
|
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `search`, `settings`
|
494
494
|
- [minProximity](#minproximity) `search`, `settings`
|
495
|
-
|
496
|
-
<!--/PARAMETERS_LINK-->
|
495
|
+
- [responseFields](#responsefields) `search`, `settings`
|
497
496
|
|
498
497
|
### Multiple queries - `multiple_queries`
|
499
498
|
|
@@ -612,7 +611,7 @@ res = index.save_objects([{"firstname" => "Jimmie",
|
|
612
611
|
"objectID" => "myID2"}])
|
613
612
|
```
|
614
613
|
|
615
|
-
To update a single object, you can use the `
|
614
|
+
To update a single object, you can use the `save_object` method:
|
616
615
|
|
617
616
|
```ruby
|
618
617
|
index.save_object({"firstname" => "Jimmie",
|
@@ -775,8 +774,6 @@ index.set_settings({"customRanking" => ["desc(followers)"]}, {"forwardToReplicas
|
|
775
774
|
|
776
775
|
### Index settings parameters
|
777
776
|
|
778
|
-
<!--PARAMETERS_LINK-->
|
779
|
-
|
780
777
|
Here is the list of parameters you can use with the set settings method (`settings` [scope](#scope)).
|
781
778
|
|
782
779
|
|
@@ -842,9 +839,6 @@ Parameters that can be overridden at search time also have the `search` [scope](
|
|
842
839
|
- [altCorrections](#altcorrections) `settings`
|
843
840
|
- [placeholders](#placeholders) `settings`
|
844
841
|
|
845
|
-
<!--/PARAMETERS_LINK-->
|
846
|
-
|
847
|
-
|
848
842
|
## Parameters
|
849
843
|
|
850
844
|
### Overview
|
@@ -952,6 +946,7 @@ They are three scopes:
|
|
952
946
|
- [placeholders](#placeholders) `settings`
|
953
947
|
- [altCorrections](#altcorrections) `settings`
|
954
948
|
- [minProximity](#minproximity) `search`, `settings`
|
949
|
+
- [responseFields](#responsefields) `search`, `settings`
|
955
950
|
|
956
951
|
### Search
|
957
952
|
|
@@ -1930,6 +1925,25 @@ Considering the query *“javascript framework”*, if you set `minProximity=2`,
|
|
1930
1925
|
|
1931
1926
|
**Note:** the maximum `minProximity` that can be set is 7. Any higher value will disable the `proximity` criterion from the ranking formula.
|
1932
1927
|
|
1928
|
+
#### responseFields
|
1929
|
+
|
1930
|
+
- scope: `search`, `settings`
|
1931
|
+
- type: `array of strings`
|
1932
|
+
- default: `*`
|
1933
|
+
|
1934
|
+
|
1935
|
+
Choose which fields the response will contain. Applies to search and browse queries.
|
1936
|
+
|
1937
|
+
By default, all fields are returned. If this parameter is specified, only the fields explicitly listed will be returned, unless `*` is used, in which case all fields are returned. Specifying an empty list or unknown field names is an error.
|
1938
|
+
|
1939
|
+
This parameter is mainly intended to limit the response size. For example, for complex queries, echoing of request parameters in the response's `params` field can be undesirable.
|
1940
|
+
|
1941
|
+
Some fields cannot be filtered out:
|
1942
|
+
|
1943
|
+
- warning `message`
|
1944
|
+
- `cursor` in browse queries
|
1945
|
+
- fields triggered explicitly via [getRankingInfo](#getrankinginfo)
|
1946
|
+
|
1933
1947
|
|
1934
1948
|
## Manage Indices
|
1935
1949
|
|
@@ -2067,7 +2081,7 @@ We have several methods to manage them:
|
|
2067
2081
|
When you need to restrict the scope of the *Search Key*, we recommend to use *Secured API Key*.
|
2068
2082
|
You can generate a *Secured API Key* from the *Search Only API Key* or any search *User API Key*
|
2069
2083
|
|
2070
|
-
There is a few things to know about
|
2084
|
+
There is a few things to know about *Secured API Keys*
|
2071
2085
|
- They always need to be generated **on your backend** using one of our API Client
|
2072
2086
|
- You can generate them on the fly (without any call to the API)
|
2073
2087
|
- They will not appear on the dashboard as they are generated without any call to the API
|
@@ -2749,3 +2763,4 @@ end
|
|
2749
2763
|
```
|
2750
2764
|
|
2751
2765
|
|
2766
|
+
|
data/lib/algolia/index.rb
CHANGED
@@ -563,7 +563,7 @@ module Algolia
|
|
563
563
|
res
|
564
564
|
end
|
565
565
|
|
566
|
-
# Search
|
566
|
+
# Search for facet values
|
567
567
|
#
|
568
568
|
# @param facet Name of the facet to search. It must have been declared in the
|
569
569
|
# index's`attributesForFaceting` setting with the `searchable()` modifier.
|
@@ -571,12 +571,15 @@ module Algolia
|
|
571
571
|
# @param query An optional query to take extra search parameters into account.
|
572
572
|
# These parameters apply to index objects like in a regular search query.
|
573
573
|
# Only facet values contained in the matched objects will be returned.
|
574
|
-
def
|
574
|
+
def search_for_facet_values(facet, text, query = {})
|
575
575
|
params = query.clone
|
576
576
|
params['facetQuery'] = text
|
577
577
|
client.post(Protocol.search_facet_uri(name, facet), params.to_json)
|
578
578
|
end
|
579
579
|
|
580
|
+
# deprecated
|
581
|
+
alias_method :search_facet, :search_for_facet_values
|
582
|
+
|
580
583
|
# Perform a search with disjunctive facets generating as many queries as number of disjunctive facets
|
581
584
|
#
|
582
585
|
# @param query the query
|
data/lib/algolia/protocol.rb
CHANGED
@@ -84,7 +84,7 @@ module Algolia
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def Protocol.search_facet_uri(index, facet)
|
87
|
-
"#{index_uri(index)}/facets/#{facet}/query"
|
87
|
+
"#{index_uri(index)}/facets/#{CGI.escape(facet)}/query"
|
88
88
|
end
|
89
89
|
|
90
90
|
def Protocol.partial_object_uri(index, object_id, create_if_not_exits = true)
|
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -841,7 +841,7 @@ describe 'Client' do
|
|
841
841
|
:facetFilters => ['kind:animal'],
|
842
842
|
:numericFilters => ['born >= 1955']
|
843
843
|
}
|
844
|
-
answer = index.
|
844
|
+
answer = index.search_for_facet_values 'series', 'Peanutz', query
|
845
845
|
expect(answer['facetHits'].size).to eq(1)
|
846
846
|
expect(answer['facetHits'].first['value']).to eq('Peanuts')
|
847
847
|
expect(answer['facetHits'].first['count']).to eq(1)
|
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.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|