From 28d890a18e897626c2955a7e7f89a9e3cba82332 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 15:44:17 +0100
Subject: [PATCH 01/11] tmp
---
openapi_spec/paths/indexes/search.yml | 83 ++++++++++++++++++++++++++-
openapi_spec/responses/Record.yml | 57 ++++++++++++++++++
openapi_spec/spec.yml | 5 +-
3 files changed, 139 insertions(+), 6 deletions(-)
create mode 100644 openapi_spec/responses/Record.yml
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index 28008eb7f6c..41110268f17 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -19,6 +19,8 @@ post:
type: object
additionalProperties: false
properties:
+ query:
+ $ref: '../../parameters.yml#/query'
hits:
type: array
items:
@@ -29,10 +31,85 @@ post:
$ref: '../../responses/common.yml#/objectID'
nbHits:
type: integer
- queryID:
+ description: "Number of hits that the search query matched"
+ example: 20
+ exhaustiveNbHits:
+ type: boolean
+ description: "Indicate if the nbHits count was exhaustive or approximate"
+ exhaustiveTypo:
+ type: boolean
+ description: "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)"
+ exhaustiveFacetsCount:
+ type: boolean
+ description: Whether the facet count is exhaustive or approximate.
+ hitsPerPage:
+ $ref: '../../parameters.yml#/hitsPerPage'
+ index:
type: string
- pattern: '^[a-f0-9]{32}$'
- example: 43b15df305339e827f0ac0bdc5ebcaa7
+ example: "indexName"
+ nbPages:
+ type: integer
+ description: "Number of pages available for the current query"
+ example: 1
+ page:
+ $ref: '../../parameters.yml#/page'
+ params:
+ type: string
+ description: A url-encoded string of all search parameters.
+ example: "query=a&hitsPerPage=20"
+ processingTimeMS:
+ type: number
+ example: 20
+ description: "Time the server took to process the request, in milliseconds."
+ userData:
+ $ref: '../../parameters.yml#/userData'
+ nbSortedHits:
+ type: integer
+ description: "The number of hits selected and sorted by the relevant sort algorithm"
+ queryAfterRemoval:
+ type: string
+ description: "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set."
+ message:
+ type: string
+ description: "Used to return warnings about the query."
+ aroundLatLng:
+ type: string
+ description: The computed geo location.
+ pattern: "^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$"
+ automaticRadius:
+ type: string
+ description: "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer."
+ serverUsed:
+ type: string
+ description: "Actual host name of the server that processed the request."
+ indexUsed:
+ type: string
+ description: "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query."
+ abTestID:
+ type: integer
+ description: "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID."
+ abTestVariantID:
+ type: integer
+ description: "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used."
+ parsedQuery:
+ type: string
+ description: "The query string that will be searched, after normalization."
+ facets:
+ type: object
+ description: "A mapping of each facet name to the corresponding facet counts."
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ example: { "facets": { "category": { "tech": 42, "food": 1 } } }
+ facets_stats:
+ type: object
+ description: "Statistics for numerical facets."
+ queryID:
+ $ref: '../../responses/common.yml#/queryID'
+
+
+
'400':
$ref: '../../responses/BadRequest.yml'
'404':
diff --git a/openapi_spec/responses/Record.yml b/openapi_spec/responses/Record.yml
new file mode 100644
index 00000000000..a9e70c65ae9
--- /dev/null
+++ b/openapi_spec/responses/Record.yml
@@ -0,0 +1,57 @@
+record:
+ type: object
+ description: A single record
+ additionalProperties: true
+ properties:
+ objectID:
+ $ref: './common.yml#/objectID'
+
+recordWithRanking:
+ type: object
+ description: A single record with ranking info
+ additionalProperties: true
+ properties:
+ objectID:
+ $ref: './common.yml#/objectID'
+ _highlightResult:
+ type: object
+ additionalProperties:
+ $ref: '#/highilightResult'
+
+# oneOf:
+# "_highlightResult": {
+# "name": {
+# "value": "George Clooney",
+# "matchLevel": "full"
+# fullyHighlighted: false
+# matchLevel: "full"
+# matchedWords: ["a"]
+# value: "What is __aa-highlight__A__/aa-highlight__lgolia?"
+# }
+# },
+
+# _snippetResult:
+# description:
+# matchLevel: "full"
+# value: "Learn __aa-hi
+
+highlighResult:
+ type: object
+ properties:
+ value:
+ type: string
+ description: "Markup text with occurrences highlighted."
+ example: "George Clooney",
+ matchLevel:
+ type: string
+ description: "Indicates how well the attribute matched the search query."
+ enum: [none, partial, full]
+ matchedWords:
+ type: array
+ description: List of words from the query that matched the object.
+ items:
+ type: string
+ fullyHighlighted:
+ type: boolean
+ description: "Whether the entire attribute value is highlighted."
+
diff --git a/openapi_spec/spec.yml b/openapi_spec/spec.yml
index c6ac21cebdb..0aac1dc76be 100644
--- a/openapi_spec/spec.yml
+++ b/openapi_spec/spec.yml
@@ -21,9 +21,8 @@ servers:
appId:
default: test
paths:
- # We can add this one later, as it requires the init method
- # /1/indexes/{indexName}/query:
- # $ref: "./paths/indexes/search.yml"
+ /1/indexes/{indexName}/query:
+ $ref: "./paths/indexes/search.yml"
/1/indexes/*/queries:
$ref: './paths/indexes/multipleQueries.yml'
/1/indexes/{indexName}:
From 3f886b8ba638a12dad829478c07f07c8e2029212 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 15:52:03 +0100
Subject: [PATCH 02/11] fix
---
openapi_spec/paths/indexes/search.yml | 135 +++++++++++++-------------
yarn.lock | 4 +-
2 files changed, 71 insertions(+), 68 deletions(-)
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index 41110268f17..e0ac91236d8 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -19,8 +19,45 @@ post:
type: object
additionalProperties: false
properties:
- query:
- $ref: '../../parameters.yml#/query'
+ abTestID:
+ type: integer
+ description: If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
+ abTestVariantID:
+ type: integer
+ description: If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.
+ aroundLatLng:
+ type: string
+ description: The computed geo location.
+ pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
+ automaticRadius:
+ type: string
+ description: The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.
+ exhaustiveFacetsCount:
+ type: boolean
+ description: Whether the facet count is exhaustive or approximate.
+ exhaustiveNbHits:
+ type: boolean
+ description: Indicate if the nbHits count was exhaustive or approximate
+ exhaustiveTypo:
+ type: boolean
+ description: Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)
+ facets:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ description: A mapping of each facet name to the corresponding facet counts.
+ example:
+ facets:
+ category:
+ food: 1
+ tech: 42
+ facets_stats:
+ type: object
+ description: Statistics for numerical facets.
+ queryID:
+ $ref: ../../responses/common.yml#/queryID
hits:
type: array
items:
@@ -28,88 +65,54 @@ post:
additionalProperties: false
properties:
objectID:
- $ref: '../../responses/common.yml#/objectID'
- nbHits:
- type: integer
- description: "Number of hits that the search query matched"
- example: 20
- exhaustiveNbHits:
- type: boolean
- description: "Indicate if the nbHits count was exhaustive or approximate"
- exhaustiveTypo:
- type: boolean
- description: "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)"
- exhaustiveFacetsCount:
- type: boolean
- description: Whether the facet count is exhaustive or approximate.
+ $ref: ../../responses/common.yml#/objectID
hitsPerPage:
- $ref: '../../parameters.yml#/hitsPerPage'
+ $ref: ../../schemas/SearchParams.yml#/properties/hitsPerPage
index:
type: string
- example: "indexName"
+ example: indexName
+ indexUsed:
+ type: string
+ description: Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
+ message:
+ type: string
+ description: Used to return warnings about the query.
+ nbHits:
+ type: integer
+ description: Number of hits that the search query matched
+ example: 20
nbPages:
type: integer
- description: "Number of pages available for the current query"
+ description: Number of pages available for the current query
example: 1
+ nbSortedHits:
+ type: integer
+ description: The number of hits selected and sorted by the relevant sort algorithm
page:
- $ref: '../../parameters.yml#/page'
+ $ref: ../../schemas/SearchParams.yml#/properties/page
params:
type: string
description: A url-encoded string of all search parameters.
- example: "query=a&hitsPerPage=20"
+ example: query=a&hitsPerPage=20
+ parsedQuery:
+ type: string
+ description: The query string that will be searched, after normalization.
processingTimeMS:
type: number
+ description: Time the server took to process the request, in milliseconds.
example: 20
- description: "Time the server took to process the request, in milliseconds."
- userData:
- $ref: '../../parameters.yml#/userData'
- nbSortedHits:
- type: integer
- description: "The number of hits selected and sorted by the relevant sort algorithm"
+ query:
+ $ref: ../../schemas/SearchParams.yml#/properties/query
queryAfterRemoval:
type: string
- description: "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set."
- message:
- type: string
- description: "Used to return warnings about the query."
- aroundLatLng:
- type: string
- description: The computed geo location.
- pattern: "^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$"
- automaticRadius:
- type: string
- description: "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer."
+ description: A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
serverUsed:
type: string
- description: "Actual host name of the server that processed the request."
- indexUsed:
- type: string
- description: "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query."
- abTestID:
- type: integer
- description: "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID."
- abTestVariantID:
- type: integer
- description: "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used."
- parsedQuery:
- type: string
- description: "The query string that will be searched, after normalization."
- facets:
- type: object
- description: "A mapping of each facet name to the corresponding facet counts."
- additionalProperties:
- type: object
- additionalProperties:
- type: string
- example: { "facets": { "category": { "tech": 42, "food": 1 } } }
- facets_stats:
- type: object
- description: "Statistics for numerical facets."
- queryID:
- $ref: '../../responses/common.yml#/queryID'
-
-
+ description: Actual host name of the server that processed the request.
+ userData:
+ $ref: ../../schemas/SearchParams.yml#/properties/userData
+ # Other codes
'400':
$ref: '../../responses/BadRequest.yml'
'404':
diff --git a/yarn.lock b/yarn.lock
index d0eced75353..e020c4dc5be 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=9f2500&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=f808d2&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 4a413d1bbbeeaf41a9e4f75a2e9f8be6b827439a80099c57ae0d2b2387da9563ff416133c028989fe17eaa95025e248f8f586d78a08f903819eacae536f73b0b
+ checksum: dba0a04b72d61deb77746a2f982a29c4342cd356a1da83219a3438c6acd11fefafb06767956bfb1bfbcdd6226ff2739e874d769c0265b884723d5aafbcd8bb33
languageName: node
linkType: hard
From bd1e42a80360171ad6aebd12c023ac2611394f26 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 16:03:59 +0100
Subject: [PATCH 03/11] all record
---
openapi_spec/responses/Record.yml | 118 ++++++++++++++++++++++++------
1 file changed, 95 insertions(+), 23 deletions(-)
diff --git a/openapi_spec/responses/Record.yml b/openapi_spec/responses/Record.yml
index a9e70c65ae9..aa3a4bbe1e9 100644
--- a/openapi_spec/responses/Record.yml
+++ b/openapi_spec/responses/Record.yml
@@ -6,9 +6,9 @@ record:
objectID:
$ref: './common.yml#/objectID'
-recordWithRanking:
+recordWithHighlight:
type: object
- description: A single record with ranking info
+ description: A single record with highlight attributes
additionalProperties: true
properties:
objectID:
@@ -16,32 +16,41 @@ recordWithRanking:
_highlightResult:
type: object
additionalProperties:
- $ref: '#/highilightResult'
-
-# oneOf:
-# "_highlightResult": {
-# "name": {
-# "value": "George Clooney",
-# "matchLevel": "full"
-# fullyHighlighted: false
-# matchLevel: "full"
-# matchedWords: ["a"]
-# value: "What is __aa-highlight__A__/aa-highlight__lgolia?"
-# }
-# },
-
-# _snippetResult:
-# description:
-# matchLevel: "full"
-# value: "Learn __aa-hi
-
-highlighResult:
+ $ref: '#/highlightResult'
+
+recordWithSnippet:
+ type: object
+ description: A single record with snippeted attributes
+ additionalProperties: true
+ properties:
+ objectID:
+ $ref: './common.yml#/objectID'
+ _snippetResult:
+ type: object
+ additionalProperties:
+ $ref: '#/snippetResult'
+
+recordWithRanking:
+ type: object
+ description: A single record with ranking information
+ additionalProperties: true
+ properties:
+ objectID:
+ $ref: './common.yml#/objectID'
+ _rankingInfo:
+ $ref: '#/rankingInfo'
+
+
+
+# Props
+highlightResult:
type: object
+ additionalProperties: false
properties:
value:
type: string
description: "Markup text with occurrences highlighted."
- example: "George Clooney",
+ example: "George Clooney"
matchLevel:
type: string
description: "Indicates how well the attribute matched the search query."
@@ -55,3 +64,66 @@ highlighResult:
type: boolean
description: "Whether the entire attribute value is highlighted."
+
+snippetResult:
+ type: object
+ additionalProperties: false
+ properties:
+ value:
+ type: string
+ description: "Markup text with occurrences highlighted."
+ example: "George Clooney..."
+ matchLevel:
+ type: string
+ description: "Indicates how well the attribute matched the search query."
+ enum: [none, partial, full]
+
+rankingInfo:
+ type: object
+ additionalProperties: false
+ properties:
+ filters:
+ type: integer
+ description: "This field is reserved for advanced usage."
+ firstMatchedWord:
+ type: integer
+ description: "Position of the most important matched attribute in the attributes to index list."
+ geoDistance:
+ type: integer
+ description: "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters)."
+ geoPrecision:
+ type: integer
+ description: "Precision used when computing the geo distance, in meters."
+ matchedGeoLocation:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties: false
+ properties:
+ lat:
+ type: float
+ description: "Latitude of the matched location."
+ lng:
+ type: float
+ description: "Longitude of the matched location."
+ distance:
+ type: integer
+ description: "Distance between the matched location and the search location (in meters)."
+ nbExactWords:
+ type: integer
+ description: "Number of exactly matched words."
+ nbTypos:
+ type: integer
+ description: "Number of typos encountered when matching the record."
+ promoted:
+ type: boolean
+ description: "Present and set to true if a Rule promoted the hit."
+ proximityDistance:
+ type: integer
+ description: "When the query contains more than one word, the sum of the distances between matched words (in meters)."
+ userScore:
+ type: integer
+ description: "Custom ranking for the object, expressed as a single integer value."
+ word:
+ type: integer
+ description: "Number of matched words, including prefixes and typos."
From 9d27bac0782b70505a07be5dee5b8eb3add38591 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 16:50:18 +0100
Subject: [PATCH 04/11] build
---
openapi_spec/paths/indexes/batch.yml | 1 +
.../paths/indexes/multipleQueries.yml | 9 +-
openapi_spec/paths/indexes/search.yml | 12 +-
.../{responses => schemas}/Record.yml | 56 +-
openapi_spec/schemas/RequestOptions.yml | 23 +
openapi_spec/spec.yml | 2 +-
output/client-search/searchApi.ts | 116 +++
output/model/inlineObject.ts | 36 +
output/model/models.ts | 18 +-
output/model/multipleQueries.ts | 2 +-
.../model/multipleQueriesResponseResults.ts | 6 +-
output/model/record.ts | 25 +
output/model/requestOptions.ts | 27 +
output/model/requestOptionsHeaders.ts | 25 +
output/model/requestOptionsTimeouts.ts | 40 +
output/model/searchParams.ts | 866 ++++++++++++++++++
output/model/singleQueryResponse.ts | 233 +++++
output/model/singleQueryResponseHits.ts | 22 +
yarn.lock | 4 +-
19 files changed, 1471 insertions(+), 52 deletions(-)
rename openapi_spec/{responses => schemas}/Record.yml (53%)
create mode 100644 openapi_spec/schemas/RequestOptions.yml
create mode 100644 output/model/inlineObject.ts
create mode 100644 output/model/record.ts
create mode 100644 output/model/requestOptions.ts
create mode 100644 output/model/requestOptionsHeaders.ts
create mode 100644 output/model/requestOptionsTimeouts.ts
create mode 100644 output/model/searchParams.ts
create mode 100644 output/model/singleQueryResponse.ts
create mode 100644 output/model/singleQueryResponseHits.ts
diff --git a/openapi_spec/paths/indexes/batch.yml b/openapi_spec/paths/indexes/batch.yml
index d8b3a46ac73..e4869fa7dea 100644
--- a/openapi_spec/paths/indexes/batch.yml
+++ b/openapi_spec/paths/indexes/batch.yml
@@ -14,6 +14,7 @@ post:
schema:
title: batchObject
type: object
+ additionalProperties: false
properties:
requests:
type: array
diff --git a/openapi_spec/paths/indexes/multipleQueries.yml b/openapi_spec/paths/indexes/multipleQueries.yml
index adccd85b2f7..f9233a62af6 100644
--- a/openapi_spec/paths/indexes/multipleQueries.yml
+++ b/openapi_spec/paths/indexes/multipleQueries.yml
@@ -27,8 +27,7 @@ post:
example: products
description: The Algolia index name
query:
- type: string
- description: The query to search for
+ $ref: ../../schemas/SearchParams.yml#/properties/query
type:
type: string
enum: [default, facet]
@@ -66,11 +65,7 @@ post:
hits:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- objectID:
- $ref: '../../responses/common.yml#/objectID'
+ $ref: ../../schemas/Record.yml#/record
nbHits:
type: integer
queryID:
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index e0ac91236d8..af9076976ff 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -8,7 +8,11 @@ post:
- $ref: '../../parameters.yml#/ApiKey'
- $ref: '../../parameters.yml#/IndexName'
requestBody:
- $ref: '../../schemas/SearchParams.yml'
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: ../../schemas/SearchParams.yml
responses:
'200':
description: OK
@@ -61,11 +65,7 @@ post:
hits:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- objectID:
- $ref: ../../responses/common.yml#/objectID
+ $ref: ../../schemas/Record.yml#/record
hitsPerPage:
$ref: ../../schemas/SearchParams.yml#/properties/hitsPerPage
index:
diff --git a/openapi_spec/responses/Record.yml b/openapi_spec/schemas/Record.yml
similarity index 53%
rename from openapi_spec/responses/Record.yml
rename to openapi_spec/schemas/Record.yml
index aa3a4bbe1e9..9b6eb205c4c 100644
--- a/openapi_spec/responses/Record.yml
+++ b/openapi_spec/schemas/Record.yml
@@ -1,10 +1,11 @@
+# TODO have a polymorphic record
record:
type: object
description: A single record
additionalProperties: true
properties:
objectID:
- $ref: './common.yml#/objectID'
+ $ref: '../responses/common.yml#/objectID'
recordWithHighlight:
type: object
@@ -12,10 +13,10 @@ recordWithHighlight:
additionalProperties: true
properties:
objectID:
- $ref: './common.yml#/objectID'
+ $ref: '../responses/common.yml#/objectID'
_highlightResult:
type: object
- additionalProperties:
+ additionalProperties:
$ref: '#/highlightResult'
recordWithSnippet:
@@ -24,10 +25,10 @@ recordWithSnippet:
additionalProperties: true
properties:
objectID:
- $ref: './common.yml#/objectID'
+ $ref: '../responses/common.yml#/objectID'
_snippetResult:
type: object
- additionalProperties:
+ additionalProperties:
$ref: '#/snippetResult'
recordWithRanking:
@@ -36,12 +37,10 @@ recordWithRanking:
additionalProperties: true
properties:
objectID:
- $ref: './common.yml#/objectID'
+ $ref: '../responses/common.yml#/objectID'
_rankingInfo:
$ref: '#/rankingInfo'
-
-
# Props
highlightResult:
type: object
@@ -49,11 +48,11 @@ highlightResult:
properties:
value:
type: string
- description: "Markup text with occurrences highlighted."
- example: "George Clooney"
+ description: 'Markup text with occurrences highlighted.'
+ example: 'George Clooney'
matchLevel:
type: string
- description: "Indicates how well the attribute matched the search query."
+ description: 'Indicates how well the attribute matched the search query.'
enum: [none, partial, full]
matchedWords:
type: array
@@ -62,8 +61,7 @@ highlightResult:
type: string
fullyHighlighted:
type: boolean
- description: "Whether the entire attribute value is highlighted."
-
+ description: 'Whether the entire attribute value is highlighted.'
snippetResult:
type: object
@@ -71,11 +69,11 @@ snippetResult:
properties:
value:
type: string
- description: "Markup text with occurrences highlighted."
- example: "George Clooney..."
+ description: 'Markup text with occurrences highlighted.'
+ example: 'George Clooney...'
matchLevel:
type: string
- description: "Indicates how well the attribute matched the search query."
+ description: 'Indicates how well the attribute matched the search query.'
enum: [none, partial, full]
rankingInfo:
@@ -84,16 +82,16 @@ rankingInfo:
properties:
filters:
type: integer
- description: "This field is reserved for advanced usage."
+ description: 'This field is reserved for advanced usage.'
firstMatchedWord:
type: integer
- description: "Position of the most important matched attribute in the attributes to index list."
+ description: 'Position of the most important matched attribute in the attributes to index list.'
geoDistance:
type: integer
- description: "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters)."
+ description: 'Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).'
geoPrecision:
type: integer
- description: "Precision used when computing the geo distance, in meters."
+ description: 'Precision used when computing the geo distance, in meters.'
matchedGeoLocation:
type: object
additionalProperties:
@@ -102,28 +100,28 @@ rankingInfo:
properties:
lat:
type: float
- description: "Latitude of the matched location."
+ description: 'Latitude of the matched location.'
lng:
type: float
- description: "Longitude of the matched location."
+ description: 'Longitude of the matched location.'
distance:
type: integer
- description: "Distance between the matched location and the search location (in meters)."
+ description: 'Distance between the matched location and the search location (in meters).'
nbExactWords:
type: integer
- description: "Number of exactly matched words."
+ description: 'Number of exactly matched words.'
nbTypos:
type: integer
- description: "Number of typos encountered when matching the record."
+ description: 'Number of typos encountered when matching the record.'
promoted:
type: boolean
- description: "Present and set to true if a Rule promoted the hit."
+ description: 'Present and set to true if a Rule promoted the hit.'
proximityDistance:
type: integer
- description: "When the query contains more than one word, the sum of the distances between matched words (in meters)."
+ description: 'When the query contains more than one word, the sum of the distances between matched words (in meters).'
userScore:
type: integer
- description: "Custom ranking for the object, expressed as a single integer value."
+ description: 'Custom ranking for the object, expressed as a single integer value.'
word:
type: integer
- description: "Number of matched words, including prefixes and typos."
+ description: 'Number of matched words, including prefixes and typos.'
diff --git a/openapi_spec/schemas/RequestOptions.yml b/openapi_spec/schemas/RequestOptions.yml
new file mode 100644
index 00000000000..5cca3c3f648
--- /dev/null
+++ b/openapi_spec/schemas/RequestOptions.yml
@@ -0,0 +1,23 @@
+# Not used yet
+
+timeouts:
+ type: object
+ additionalProperties: false
+ properties:
+ connect:
+ type: integer
+ description: 'Connection timeout in seconds.'
+ example: 2
+ read:
+ type: integer
+ description: 'Read timeout in seconds.'
+ example: 5
+ write:
+ type: integer
+ description: 'Write timeout in seconds.'
+ example: 30
+
+X-Algolia-UserToken:
+ type: string
+X-Forwarded-For:
+ type: string
diff --git a/openapi_spec/spec.yml b/openapi_spec/spec.yml
index 0aac1dc76be..90700571856 100644
--- a/openapi_spec/spec.yml
+++ b/openapi_spec/spec.yml
@@ -22,7 +22,7 @@ servers:
default: test
paths:
/1/indexes/{indexName}/query:
- $ref: "./paths/indexes/search.yml"
+ $ref: './paths/indexes/search.yml'
/1/indexes/*/queries:
$ref: './paths/indexes/multipleQueries.yml'
/1/indexes/{indexName}:
diff --git a/output/client-search/searchApi.ts b/output/client-search/searchApi.ts
index bcce3ced559..74073a4b197 100644
--- a/output/client-search/searchApi.ts
+++ b/output/client-search/searchApi.ts
@@ -6,6 +6,8 @@ import { BatchResponse } from '../model/batchResponse';
import { MultipleQueriesObject } from '../model/multipleQueriesObject';
import { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
import { SaveObjectResponse } from '../model/saveObjectResponse';
+import { SearchParams } from '../model/searchParams';
+import { SingleQueryResponse } from '../model/singleQueryResponse';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
@@ -411,4 +413,118 @@ export class SearchApi {
);
});
}
+ /**
+ *
+ * @summary Get search results
+ * @param xAlgoliaApplicationId Algolia appID
+ * @param xAlgoliaAPIKey Algolia API key
+ * @param indexName The index in which to perform the request
+ * @param searchParams
+ */
+ public async search(
+ xAlgoliaApplicationId: string,
+ xAlgoliaAPIKey: string,
+ indexName: string,
+ searchParams: SearchParams,
+ options: { headers: { [name: string]: string } } = { headers: {} }
+ ): Promise<{ response: http.IncomingMessage; body: SingleQueryResponse }> {
+ const localVarPath =
+ this.basePath +
+ '/1/indexes/{indexName}/query'.replace(
+ '{' + 'indexName' + '}',
+ encodeURIComponent(String(indexName))
+ );
+ let localVarQueryParameters: any = {};
+ let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
+ const produces = ['application/json'];
+ // give precedence to 'application/json'
+ if (produces.indexOf('application/json') >= 0) {
+ localVarHeaderParams.Accept = 'application/json';
+ } else {
+ localVarHeaderParams.Accept = produces.join(',');
+ }
+ let localVarFormParams: any = {};
+
+ // verify required parameter 'xAlgoliaApplicationId' is not null or undefined
+ if (xAlgoliaApplicationId === null || xAlgoliaApplicationId === undefined) {
+ throw new Error(
+ 'Required parameter xAlgoliaApplicationId was null or undefined when calling search.'
+ );
+ }
+
+ // verify required parameter 'xAlgoliaAPIKey' is not null or undefined
+ if (xAlgoliaAPIKey === null || xAlgoliaAPIKey === undefined) {
+ throw new Error(
+ 'Required parameter xAlgoliaAPIKey was null or undefined when calling search.'
+ );
+ }
+
+ // verify required parameter 'indexName' is not null or undefined
+ if (indexName === null || indexName === undefined) {
+ throw new Error('Required parameter indexName was null or undefined when calling search.');
+ }
+
+ // verify required parameter 'searchParams' is not null or undefined
+ if (searchParams === null || searchParams === undefined) {
+ throw new Error('Required parameter searchParams was null or undefined when calling search.');
+ }
+
+ localVarHeaderParams['X-Algolia-Application-Id'] = ObjectSerializer.serialize(
+ xAlgoliaApplicationId,
+ 'string'
+ );
+ localVarHeaderParams['X-Algolia-API-Key'] = ObjectSerializer.serialize(
+ xAlgoliaAPIKey,
+ 'string'
+ );
+ (Object).assign(localVarHeaderParams, options.headers);
+
+ let localVarUseFormData = false;
+
+ let localVarRequestOptions: localVarRequest.Options = {
+ method: 'POST',
+ qs: localVarQueryParameters,
+ headers: localVarHeaderParams,
+ uri: localVarPath,
+ useQuerystring: this._useQuerystring,
+ json: true,
+ body: ObjectSerializer.serialize(searchParams, 'SearchParams'),
+ };
+
+ let authenticationPromise = Promise.resolve();
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.default.applyToRequest(localVarRequestOptions)
+ );
+
+ let interceptorPromise = authenticationPromise;
+ for (const interceptor of this.interceptors) {
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
+ }
+
+ return interceptorPromise.then(() => {
+ if (Object.keys(localVarFormParams).length) {
+ if (localVarUseFormData) {
+ (localVarRequestOptions).formData = localVarFormParams;
+ } else {
+ localVarRequestOptions.form = localVarFormParams;
+ }
+ }
+ return new Promise<{ response: http.IncomingMessage; body: SingleQueryResponse }>(
+ (resolve, reject) => {
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
+ if (error) {
+ reject(error);
+ } else {
+ body = ObjectSerializer.deserialize(body, 'SingleQueryResponse');
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
+ resolve({ response: response, body: body });
+ } else {
+ reject(new HttpError(response, body, response.statusCode));
+ }
+ }
+ });
+ }
+ );
+ });
+ }
}
diff --git a/output/model/inlineObject.ts b/output/model/inlineObject.ts
new file mode 100644
index 00000000000..cd3ae43af0d
--- /dev/null
+++ b/output/model/inlineObject.ts
@@ -0,0 +1,36 @@
+import { RequestFile } from './models';
+import { RequestOptions } from './requestOptions';
+import { SearchParams } from './searchParams';
+
+export class InlineObject {
+ /**
+ * The text to search in the index.
+ */
+ 'query'?: string;
+ 'searchParameters'?: SearchParams;
+ '_requestOptions'?: RequestOptions;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'query',
+ baseName: 'query',
+ type: 'string',
+ },
+ {
+ name: 'searchParameters',
+ baseName: 'searchParameters',
+ type: 'SearchParams',
+ },
+ {
+ name: '_requestOptions',
+ baseName: 'requestOptions',
+ type: 'RequestOptions',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return InlineObject.attributeTypeMap;
+ }
+}
diff --git a/output/model/models.ts b/output/model/models.ts
index dd7ce871f8a..37848617f3f 100644
--- a/output/model/models.ts
+++ b/output/model/models.ts
@@ -6,10 +6,12 @@ export * from './modelError';
export * from './multipleQueries';
export * from './multipleQueriesObject';
export * from './multipleQueriesResponse';
-export * from './multipleQueriesResponseHits';
export * from './multipleQueriesResponseResults';
export * from './operation';
+export * from './record';
export * from './saveObjectResponse';
+export * from './searchParams';
+export * from './singleQueryResponse';
import * as fs from 'fs';
@@ -29,10 +31,12 @@ import { ModelError } from './modelError';
import { MultipleQueries } from './multipleQueries';
import { MultipleQueriesObject } from './multipleQueriesObject';
import { MultipleQueriesResponse } from './multipleQueriesResponse';
-import { MultipleQueriesResponseHits } from './multipleQueriesResponseHits';
import { MultipleQueriesResponseResults } from './multipleQueriesResponseResults';
import { Operation } from './operation';
+import { Record } from './record';
import { SaveObjectResponse } from './saveObjectResponse';
+import { SearchParams } from './searchParams';
+import { SingleQueryResponse } from './singleQueryResponse';
let primitives = ['string', 'boolean', 'double', 'integer', 'long', 'float', 'number', 'any'];
@@ -40,6 +44,12 @@ let enumsMap: { [index: string]: any } = {
'MultipleQueries.TypeEnum': MultipleQueries.TypeEnum,
'MultipleQueriesObject.StrategyEnum': MultipleQueriesObject.StrategyEnum,
'Operation.ActionEnum': Operation.ActionEnum,
+ 'SearchParams.TypoToleranceEnum': SearchParams.TypoToleranceEnum,
+ 'SearchParams.QueryTypeEnum': SearchParams.QueryTypeEnum,
+ 'SearchParams.RemoveWordsIfNoResultsEnum': SearchParams.RemoveWordsIfNoResultsEnum,
+ 'SearchParams.ExactOnSingleWordQueryEnum': SearchParams.ExactOnSingleWordQueryEnum,
+ 'SearchParams.AlternativesAsExactEnum': SearchParams.AlternativesAsExactEnum,
+ 'SearchParams.AdvancedSyntaxFeaturesEnum': SearchParams.AdvancedSyntaxFeaturesEnum,
};
let typeMap: { [index: string]: any } = {
@@ -49,10 +59,12 @@ let typeMap: { [index: string]: any } = {
MultipleQueries: MultipleQueries,
MultipleQueriesObject: MultipleQueriesObject,
MultipleQueriesResponse: MultipleQueriesResponse,
- MultipleQueriesResponseHits: MultipleQueriesResponseHits,
MultipleQueriesResponseResults: MultipleQueriesResponseResults,
Operation: Operation,
+ Record: Record,
SaveObjectResponse: SaveObjectResponse,
+ SearchParams: SearchParams,
+ SingleQueryResponse: SingleQueryResponse,
};
export class ObjectSerializer {
diff --git a/output/model/multipleQueries.ts b/output/model/multipleQueries.ts
index 3842566ce64..ec21e366b48 100644
--- a/output/model/multipleQueries.ts
+++ b/output/model/multipleQueries.ts
@@ -6,7 +6,7 @@ export class MultipleQueries {
*/
'indexName': string;
/**
- * The query to search for
+ * The text to search in the index.
*/
'query'?: string;
/**
diff --git a/output/model/multipleQueriesResponseResults.ts b/output/model/multipleQueriesResponseResults.ts
index b15174ff452..dce9fe2a8b3 100644
--- a/output/model/multipleQueriesResponseResults.ts
+++ b/output/model/multipleQueriesResponseResults.ts
@@ -1,8 +1,8 @@
import { RequestFile } from './models';
-import { MultipleQueriesResponseHits } from './multipleQueriesResponseHits';
+import { Record } from './record';
export class MultipleQueriesResponseResults {
- 'hits'?: Array;
+ 'hits'?: Array;
'nbHits'?: number;
'queryID'?: string;
@@ -12,7 +12,7 @@ export class MultipleQueriesResponseResults {
{
name: 'hits',
baseName: 'hits',
- type: 'Array',
+ type: 'Array',
},
{
name: 'nbHits',
diff --git a/output/model/record.ts b/output/model/record.ts
new file mode 100644
index 00000000000..f0d5f43029f
--- /dev/null
+++ b/output/model/record.ts
@@ -0,0 +1,25 @@
+import { RequestFile } from './models';
+
+/**
+ * A single record
+ */
+export class Record extends null {
+ /**
+ * Unique identifier of the object
+ */
+ 'objectID'?: string;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'objectID',
+ baseName: 'objectID',
+ type: 'string',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return super.getAttributeTypeMap().concat(Record.attributeTypeMap);
+ }
+}
diff --git a/output/model/requestOptions.ts b/output/model/requestOptions.ts
new file mode 100644
index 00000000000..7033cb2f63c
--- /dev/null
+++ b/output/model/requestOptions.ts
@@ -0,0 +1,27 @@
+import { RequestFile } from './models';
+import { RequestOptionsHeaders } from './requestOptionsHeaders';
+import { RequestOptionsTimeouts } from './requestOptionsTimeouts';
+
+export class RequestOptions {
+ 'headers'?: RequestOptionsHeaders;
+ 'timeouts'?: RequestOptionsTimeouts;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'headers',
+ baseName: 'headers',
+ type: 'RequestOptionsHeaders',
+ },
+ {
+ name: 'timeouts',
+ baseName: 'timeouts',
+ type: 'RequestOptionsTimeouts',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return RequestOptions.attributeTypeMap;
+ }
+}
diff --git a/output/model/requestOptionsHeaders.ts b/output/model/requestOptionsHeaders.ts
new file mode 100644
index 00000000000..1e61c8b397d
--- /dev/null
+++ b/output/model/requestOptionsHeaders.ts
@@ -0,0 +1,25 @@
+import { RequestFile } from './models';
+
+export class RequestOptionsHeaders {
+ 'xAlgoliaUserToken'?: string;
+ 'xForwardedFor'?: string;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'xAlgoliaUserToken',
+ baseName: 'X-Algolia-UserToken',
+ type: 'string',
+ },
+ {
+ name: 'xForwardedFor',
+ baseName: 'X-Forwarded-For',
+ type: 'string',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return RequestOptionsHeaders.attributeTypeMap;
+ }
+}
diff --git a/output/model/requestOptionsTimeouts.ts b/output/model/requestOptionsTimeouts.ts
new file mode 100644
index 00000000000..1c43be46d63
--- /dev/null
+++ b/output/model/requestOptionsTimeouts.ts
@@ -0,0 +1,40 @@
+import { RequestFile } from './models';
+
+export class RequestOptionsTimeouts {
+ /**
+ * Connection timeout in seconds.
+ */
+ 'connect'?: number;
+ /**
+ * Read timeout in seconds.
+ */
+ 'read'?: number;
+ /**
+ * Write timeout in seconds.
+ */
+ 'write'?: number;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'connect',
+ baseName: 'connect',
+ type: 'number',
+ },
+ {
+ name: 'read',
+ baseName: 'read',
+ type: 'number',
+ },
+ {
+ name: 'write',
+ baseName: 'write',
+ type: 'number',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return RequestOptionsTimeouts.attributeTypeMap;
+ }
+}
diff --git a/output/model/searchParams.ts b/output/model/searchParams.ts
new file mode 100644
index 00000000000..bf4ca930756
--- /dev/null
+++ b/output/model/searchParams.ts
@@ -0,0 +1,866 @@
+import { RequestFile } from './models';
+
+export class SearchParams {
+ /**
+ * The text to search in the index.
+ */
+ 'query'?: string;
+ /**
+ * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.
+ */
+ 'similarQuery'?: string;
+ /**
+ * The complete list of attributes used for searching.
+ */
+ 'searchableAttributes'?: Array;
+ /**
+ * The complete list of attributes that will be used for faceting.
+ */
+ 'attributesForFaceting'?: Array;
+ /**
+ * List of attributes that can’t be retrieved at query time.
+ */
+ 'unretrievableAttributes'?: Array;
+ /**
+ * This parameter controls which attributes to retrieve and which not to retrieve.
+ */
+ 'attributesToRetrieve'?: Array;
+ /**
+ * Restricts a given query to look in only a subset of your searchable attributes.
+ */
+ 'restrictSearchableAttributes'?: Array;
+ /**
+ * Controls how Algolia should sort your results.
+ */
+ 'ranking'?: Array;
+ /**
+ * Specifies the custom ranking criterion.
+ */
+ 'customRanking'?: Array;
+ /**
+ * Controls the relevancy threshold below which less relevant results aren’t included in the results.
+ */
+ 'relevancyStrictness'?: number;
+ /**
+ * Creates replicas, exact copies of an index.
+ */
+ 'replicas'?: Array;
+ /**
+ * Filter the query with numeric, facet and/or tag filters.
+ */
+ 'filters'?: string;
+ /**
+ * Filter hits by facet value.
+ */
+ 'facetFilters'?: Array;
+ /**
+ * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.
+ */
+ 'optionalFilters'?: Array;
+ /**
+ * Filter on numeric attributes.
+ */
+ 'numericFilters'?: Array;
+ /**
+ * Filter hits by tags.
+ */
+ 'tagFilters'?: Array;
+ /**
+ * Determines how to calculate the total score for filtering.
+ */
+ 'sumOrFiltersScores'?: boolean;
+ /**
+ * Retrieve facets and their facet values.
+ */
+ 'facets'?: Array;
+ /**
+ * Maximum number of facet values to return for each facet during a regular search.
+ */
+ 'maxValuesPerFacet'?: number;
+ /**
+ * Force faceting to be applied after de-duplication (via the Distinct setting).
+ */
+ 'facetingAfterDistinct'?: boolean;
+ /**
+ * Controls how facet values are fetched.
+ */
+ 'sortFacetValuesBy'?: string;
+ /**
+ * List of attributes to highlight.
+ */
+ 'attributesToHighlight'?: Array;
+ /**
+ * List of attributes to snippet, with an optional maximum number of words to snippet.
+ */
+ 'attributesToSnippet'?: Array;
+ /**
+ * The HTML string to insert before the highlighted parts in all highlight and snippet results.
+ */
+ 'highlightPreTag'?: string;
+ /**
+ * The HTML string to insert after the highlighted parts in all highlight and snippet results.
+ */
+ 'highlightPostTag'?: string;
+ /**
+ * String used as an ellipsis indicator when a snippet is truncated.
+ */
+ 'snippetEllipsisText'?: string;
+ /**
+ * Restrict highlighting and snippeting to items that matched the query.
+ */
+ 'restrictHighlightAndSnippetArrays'?: boolean;
+ /**
+ * Specify the page to retrieve.
+ */
+ 'page'?: number;
+ /**
+ * Set the number of hits per page.
+ */
+ 'hitsPerPage'?: number;
+ /**
+ * Specify the offset of the first hit to return.
+ */
+ 'offset'?: number;
+ /**
+ * Set the number of hits to retrieve (used only with offset).
+ */
+ 'length'?: number;
+ /**
+ * Set the maximum number of hits accessible via pagination.
+ */
+ 'paginationLimitedTo'?: number;
+ /**
+ * Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
+ */
+ 'minWordSizefor1Typo'?: number;
+ /**
+ * Minimum number of characters a word in the query string must contain to accept matches with 2 typos.
+ */
+ 'minWordSizefor2Typos'?: number;
+ /**
+ * Controls whether typo tolerance is enabled and how it is applied.
+ */
+ 'typoTolerance'?: SearchParams.TypoToleranceEnum;
+ /**
+ * Whether to allow typos on numbers (“numeric tokens”) in the query string.
+ */
+ 'allowTyposOnNumericTokens'?: boolean;
+ /**
+ * List of attributes on which you want to disable typo tolerance.
+ */
+ 'disableTypoToleranceOnAttributes'?: Array;
+ /**
+ * A list of words for which you want to turn off typo tolerance.
+ */
+ 'disableTypoToleranceOnWords'?: Array;
+ /**
+ * Control which separators are indexed.
+ */
+ 'separatorsToIndex'?: string;
+ /**
+ * Search for entries around a central geolocation, enabling a geo search within a circular area.
+ */
+ 'aroundLatLng'?: string;
+ /**
+ * Search for entries around a given location automatically computed from the requester’s IP address.
+ */
+ 'aroundLatLngViaIP'?: boolean;
+ /**
+ * Define the maximum radius for a geo search (in meters).
+ */
+ 'aroundRadius'?: string;
+ /**
+ * Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
+ */
+ 'aroundPrecision'?: number;
+ /**
+ * Minimum radius (in meters) used for a geo search when aroundRadius is not set.
+ */
+ 'minimumAroundRadius'?: number;
+ /**
+ * Search inside a rectangular area (in geo coordinates).
+ */
+ 'insideBoundingBox'?: Array;
+ /**
+ * Search inside a polygon (in geo coordinates).
+ */
+ 'insidePolygon'?: Array;
+ /**
+ * Treats singular, plurals, and other forms of declensions as matching terms.
+ */
+ 'ignorePlurals'?: string;
+ /**
+ * Specify on which attributes to apply transliteration.
+ */
+ 'attributesToTransliterate'?: Array;
+ /**
+ * Removes stop (common) words from the query before executing it.
+ */
+ 'removeStopWords'?: string;
+ /**
+ * List of attributes on which to do a decomposition of camel case words.
+ */
+ 'camelCaseAttributes'?: Array;
+ /**
+ * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
+ */
+ 'decompoundedAttributes'?: { [key: string]: object };
+ /**
+ * List of characters that the engine shouldn’t automatically normalize.
+ */
+ 'keepDiacriticsOnCharacters'?: string;
+ /**
+ * Override the default normalization handled by the engine.
+ */
+ 'customNormalization'?: { [key: string]: object };
+ /**
+ * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
+ */
+ 'queryLanguages'?: Array;
+ /**
+ * Sets the languages at the index level for language-specific processing such as tokenization and normalization.
+ */
+ 'indexLanguages'?: Array;
+ /**
+ * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.
+ */
+ 'naturalLanguages'?: Array;
+ /**
+ * Splits compound words into their composing atoms in the query.
+ */
+ 'decompoundQuery'?: boolean;
+ /**
+ * Whether Rules should be globally enabled.
+ */
+ 'enableRules'?: boolean;
+ /**
+ * Whether promoted results should match the filters of the current search, except for geographic filters.
+ */
+ 'filterPromotes'?: boolean;
+ /**
+ * Enables contextual rules.
+ */
+ 'ruleContexts'?: Array;
+ /**
+ * Enable the Personalization feature.
+ */
+ 'enablePersonalization'?: boolean;
+ /**
+ * Define the impact of the Personalization feature.
+ */
+ 'personalizationImpact'?: number;
+ /**
+ * Associates a certain user token with the current search.
+ */
+ 'userToken'?: string;
+ /**
+ * Controls if and how query words are interpreted as prefixes.
+ */
+ 'queryType'?: SearchParams.QueryTypeEnum;
+ /**
+ * Selects a strategy to remove words from the query when it doesn’t match any hits.
+ */
+ 'removeWordsIfNoResults'?: SearchParams.RemoveWordsIfNoResultsEnum;
+ /**
+ * Enables the advanced query syntax.
+ */
+ 'advancedSyntax'?: boolean;
+ /**
+ * A list of words that should be considered as optional when found in the query.
+ */
+ 'optionalWords'?: Array;
+ /**
+ * List of attributes on which you want to disable prefix matching.
+ */
+ 'disablePrefixOnAttributes'?: Array;
+ /**
+ * List of attributes on which you want to disable the exact ranking criterion.
+ */
+ 'disableExactOnAttributes'?: Array;
+ /**
+ * Controls how the exact ranking criterion is computed when the query contains only one word.
+ */
+ 'exactOnSingleWordQuery'?: SearchParams.ExactOnSingleWordQueryEnum;
+ /**
+ * List of alternatives that should be considered an exact match by the exact ranking criterion.
+ */
+ 'alternativesAsExact'?: Array;
+ /**
+ * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.
+ */
+ 'advancedSyntaxFeatures'?: Array;
+ /**
+ * List of numeric attributes that can be used as numerical filters.
+ */
+ 'numericAttributesForFiltering'?: Array;
+ /**
+ * Enables compression of large integer arrays.
+ */
+ 'allowCompressionOfIntegerArray'?: boolean;
+ /**
+ * Name of the de-duplication attribute to be used with the distinct feature.
+ */
+ 'attributeForDistinct'?: string;
+ /**
+ * Enables de-duplication or grouping of results.
+ */
+ 'distinct'?: number;
+ /**
+ * Retrieve detailed ranking information.
+ */
+ 'getRankingInfo'?: boolean;
+ /**
+ * Enable the Click Analytics feature.
+ */
+ 'clickAnalytics'?: boolean;
+ /**
+ * Whether the current query will be taken into account in the Analytics.
+ */
+ 'analytics'?: boolean;
+ /**
+ * List of tags to apply to the query for analytics purposes.
+ */
+ 'analyticsTags'?: Array;
+ /**
+ * Whether to take into account an index’s synonyms for a particular search.
+ */
+ 'synonyms'?: boolean;
+ /**
+ * Whether to highlight and snippet the original word that matches the synonym or the synonym itself.
+ */
+ 'replaceSynonymsInHighlight'?: boolean;
+ /**
+ * Precision of the proximity ranking criterion.
+ */
+ 'minProximity'?: number;
+ /**
+ * Choose which fields to return in the API response. This parameters applies to search and browse queries.
+ */
+ 'responseFields'?: Array;
+ /**
+ * Maximum number of facet hits to return during a search for facet values.
+ */
+ 'maxFacetHits'?: number;
+ /**
+ * Whether to include or exclude a query from the processing-time percentile computation.
+ */
+ 'percentileComputation'?: boolean;
+ /**
+ * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
+ */
+ 'attributeCriteriaComputedByMinProximity'?: boolean;
+ /**
+ * Lets you store custom data in your indices.
+ */
+ 'userData'?: { [key: string]: object };
+ /**
+ * Whether this search should participate in running AB tests.
+ */
+ 'enableABTest'?: boolean;
+ /**
+ * Whether this search should use AI Re-Ranking.
+ */
+ 'enableReRanking'?: boolean;
+ /**
+ * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
+ */
+ 'renderingContent'?: object;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'query',
+ baseName: 'query',
+ type: 'string',
+ },
+ {
+ name: 'similarQuery',
+ baseName: 'similarQuery',
+ type: 'string',
+ },
+ {
+ name: 'searchableAttributes',
+ baseName: 'searchableAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'attributesForFaceting',
+ baseName: 'attributesForFaceting',
+ type: 'Array',
+ },
+ {
+ name: 'unretrievableAttributes',
+ baseName: 'unretrievableAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'attributesToRetrieve',
+ baseName: 'attributesToRetrieve',
+ type: 'Array',
+ },
+ {
+ name: 'restrictSearchableAttributes',
+ baseName: 'restrictSearchableAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'ranking',
+ baseName: 'ranking',
+ type: 'Array',
+ },
+ {
+ name: 'customRanking',
+ baseName: 'customRanking',
+ type: 'Array',
+ },
+ {
+ name: 'relevancyStrictness',
+ baseName: 'relevancyStrictness',
+ type: 'number',
+ },
+ {
+ name: 'replicas',
+ baseName: 'replicas',
+ type: 'Array',
+ },
+ {
+ name: 'filters',
+ baseName: 'filters',
+ type: 'string',
+ },
+ {
+ name: 'facetFilters',
+ baseName: 'facetFilters',
+ type: 'Array',
+ },
+ {
+ name: 'optionalFilters',
+ baseName: 'optionalFilters',
+ type: 'Array',
+ },
+ {
+ name: 'numericFilters',
+ baseName: 'numericFilters',
+ type: 'Array',
+ },
+ {
+ name: 'tagFilters',
+ baseName: 'tagFilters',
+ type: 'Array',
+ },
+ {
+ name: 'sumOrFiltersScores',
+ baseName: 'sumOrFiltersScores',
+ type: 'boolean',
+ },
+ {
+ name: 'facets',
+ baseName: 'facets',
+ type: 'Array',
+ },
+ {
+ name: 'maxValuesPerFacet',
+ baseName: 'maxValuesPerFacet',
+ type: 'number',
+ },
+ {
+ name: 'facetingAfterDistinct',
+ baseName: 'facetingAfterDistinct',
+ type: 'boolean',
+ },
+ {
+ name: 'sortFacetValuesBy',
+ baseName: 'sortFacetValuesBy',
+ type: 'string',
+ },
+ {
+ name: 'attributesToHighlight',
+ baseName: 'attributesToHighlight',
+ type: 'Array',
+ },
+ {
+ name: 'attributesToSnippet',
+ baseName: 'attributesToSnippet',
+ type: 'Array',
+ },
+ {
+ name: 'highlightPreTag',
+ baseName: 'highlightPreTag',
+ type: 'string',
+ },
+ {
+ name: 'highlightPostTag',
+ baseName: 'highlightPostTag',
+ type: 'string',
+ },
+ {
+ name: 'snippetEllipsisText',
+ baseName: 'snippetEllipsisText',
+ type: 'string',
+ },
+ {
+ name: 'restrictHighlightAndSnippetArrays',
+ baseName: 'restrictHighlightAndSnippetArrays',
+ type: 'boolean',
+ },
+ {
+ name: 'page',
+ baseName: 'page',
+ type: 'number',
+ },
+ {
+ name: 'hitsPerPage',
+ baseName: 'hitsPerPage',
+ type: 'number',
+ },
+ {
+ name: 'offset',
+ baseName: 'offset',
+ type: 'number',
+ },
+ {
+ name: 'length',
+ baseName: 'length',
+ type: 'number',
+ },
+ {
+ name: 'paginationLimitedTo',
+ baseName: 'paginationLimitedTo',
+ type: 'number',
+ },
+ {
+ name: 'minWordSizefor1Typo',
+ baseName: 'minWordSizefor1Typo',
+ type: 'number',
+ },
+ {
+ name: 'minWordSizefor2Typos',
+ baseName: 'minWordSizefor2Typos',
+ type: 'number',
+ },
+ {
+ name: 'typoTolerance',
+ baseName: 'typoTolerance',
+ type: 'SearchParams.TypoToleranceEnum',
+ },
+ {
+ name: 'allowTyposOnNumericTokens',
+ baseName: 'allowTyposOnNumericTokens',
+ type: 'boolean',
+ },
+ {
+ name: 'disableTypoToleranceOnAttributes',
+ baseName: 'disableTypoToleranceOnAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'disableTypoToleranceOnWords',
+ baseName: 'disableTypoToleranceOnWords',
+ type: 'Array',
+ },
+ {
+ name: 'separatorsToIndex',
+ baseName: 'separatorsToIndex',
+ type: 'string',
+ },
+ {
+ name: 'aroundLatLng',
+ baseName: 'aroundLatLng',
+ type: 'string',
+ },
+ {
+ name: 'aroundLatLngViaIP',
+ baseName: 'aroundLatLngViaIP',
+ type: 'boolean',
+ },
+ {
+ name: 'aroundRadius',
+ baseName: 'aroundRadius',
+ type: 'string',
+ },
+ {
+ name: 'aroundPrecision',
+ baseName: 'aroundPrecision',
+ type: 'number',
+ },
+ {
+ name: 'minimumAroundRadius',
+ baseName: 'minimumAroundRadius',
+ type: 'number',
+ },
+ {
+ name: 'insideBoundingBox',
+ baseName: 'insideBoundingBox',
+ type: 'Array',
+ },
+ {
+ name: 'insidePolygon',
+ baseName: 'insidePolygon',
+ type: 'Array',
+ },
+ {
+ name: 'ignorePlurals',
+ baseName: 'ignorePlurals',
+ type: 'string',
+ },
+ {
+ name: 'attributesToTransliterate',
+ baseName: 'attributesToTransliterate',
+ type: 'Array',
+ },
+ {
+ name: 'removeStopWords',
+ baseName: 'removeStopWords',
+ type: 'string',
+ },
+ {
+ name: 'camelCaseAttributes',
+ baseName: 'camelCaseAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'decompoundedAttributes',
+ baseName: 'decompoundedAttributes',
+ type: '{ [key: string]: object; }',
+ },
+ {
+ name: 'keepDiacriticsOnCharacters',
+ baseName: 'keepDiacriticsOnCharacters',
+ type: 'string',
+ },
+ {
+ name: 'customNormalization',
+ baseName: 'customNormalization',
+ type: '{ [key: string]: object; }',
+ },
+ {
+ name: 'queryLanguages',
+ baseName: 'queryLanguages',
+ type: 'Array',
+ },
+ {
+ name: 'indexLanguages',
+ baseName: 'indexLanguages',
+ type: 'Array',
+ },
+ {
+ name: 'naturalLanguages',
+ baseName: 'naturalLanguages',
+ type: 'Array',
+ },
+ {
+ name: 'decompoundQuery',
+ baseName: 'decompoundQuery',
+ type: 'boolean',
+ },
+ {
+ name: 'enableRules',
+ baseName: 'enableRules',
+ type: 'boolean',
+ },
+ {
+ name: 'filterPromotes',
+ baseName: 'filterPromotes',
+ type: 'boolean',
+ },
+ {
+ name: 'ruleContexts',
+ baseName: 'ruleContexts',
+ type: 'Array',
+ },
+ {
+ name: 'enablePersonalization',
+ baseName: 'enablePersonalization',
+ type: 'boolean',
+ },
+ {
+ name: 'personalizationImpact',
+ baseName: 'personalizationImpact',
+ type: 'number',
+ },
+ {
+ name: 'userToken',
+ baseName: 'userToken',
+ type: 'string',
+ },
+ {
+ name: 'queryType',
+ baseName: 'queryType',
+ type: 'SearchParams.QueryTypeEnum',
+ },
+ {
+ name: 'removeWordsIfNoResults',
+ baseName: 'removeWordsIfNoResults',
+ type: 'SearchParams.RemoveWordsIfNoResultsEnum',
+ },
+ {
+ name: 'advancedSyntax',
+ baseName: 'advancedSyntax',
+ type: 'boolean',
+ },
+ {
+ name: 'optionalWords',
+ baseName: 'optionalWords',
+ type: 'Array',
+ },
+ {
+ name: 'disablePrefixOnAttributes',
+ baseName: 'disablePrefixOnAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'disableExactOnAttributes',
+ baseName: 'disableExactOnAttributes',
+ type: 'Array',
+ },
+ {
+ name: 'exactOnSingleWordQuery',
+ baseName: 'exactOnSingleWordQuery',
+ type: 'SearchParams.ExactOnSingleWordQueryEnum',
+ },
+ {
+ name: 'alternativesAsExact',
+ baseName: 'alternativesAsExact',
+ type: 'Array',
+ },
+ {
+ name: 'advancedSyntaxFeatures',
+ baseName: 'advancedSyntaxFeatures',
+ type: 'Array',
+ },
+ {
+ name: 'numericAttributesForFiltering',
+ baseName: 'numericAttributesForFiltering',
+ type: 'Array',
+ },
+ {
+ name: 'allowCompressionOfIntegerArray',
+ baseName: 'allowCompressionOfIntegerArray',
+ type: 'boolean',
+ },
+ {
+ name: 'attributeForDistinct',
+ baseName: 'attributeForDistinct',
+ type: 'string',
+ },
+ {
+ name: 'distinct',
+ baseName: 'distinct',
+ type: 'number',
+ },
+ {
+ name: 'getRankingInfo',
+ baseName: 'getRankingInfo',
+ type: 'boolean',
+ },
+ {
+ name: 'clickAnalytics',
+ baseName: 'clickAnalytics',
+ type: 'boolean',
+ },
+ {
+ name: 'analytics',
+ baseName: 'analytics',
+ type: 'boolean',
+ },
+ {
+ name: 'analyticsTags',
+ baseName: 'analyticsTags',
+ type: 'Array',
+ },
+ {
+ name: 'synonyms',
+ baseName: 'synonyms',
+ type: 'boolean',
+ },
+ {
+ name: 'replaceSynonymsInHighlight',
+ baseName: 'replaceSynonymsInHighlight',
+ type: 'boolean',
+ },
+ {
+ name: 'minProximity',
+ baseName: 'minProximity',
+ type: 'number',
+ },
+ {
+ name: 'responseFields',
+ baseName: 'responseFields',
+ type: 'Array',
+ },
+ {
+ name: 'maxFacetHits',
+ baseName: 'maxFacetHits',
+ type: 'number',
+ },
+ {
+ name: 'percentileComputation',
+ baseName: 'percentileComputation',
+ type: 'boolean',
+ },
+ {
+ name: 'attributeCriteriaComputedByMinProximity',
+ baseName: 'attributeCriteriaComputedByMinProximity',
+ type: 'boolean',
+ },
+ {
+ name: 'userData',
+ baseName: 'userData',
+ type: '{ [key: string]: object; }',
+ },
+ {
+ name: 'enableABTest',
+ baseName: 'enableABTest',
+ type: 'boolean',
+ },
+ {
+ name: 'enableReRanking',
+ baseName: 'enableReRanking',
+ type: 'boolean',
+ },
+ {
+ name: 'renderingContent',
+ baseName: 'renderingContent',
+ type: 'object',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SearchParams.attributeTypeMap;
+ }
+}
+
+export namespace SearchParams {
+ export enum TypoToleranceEnum {
+ True = 'true',
+ False = 'false',
+ Min = 'min',
+ Strict = 'strict',
+ }
+ export enum QueryTypeEnum {
+ PrefixLast = 'prefixLast',
+ PrefixAll = 'prefixAll',
+ PrefixNone = 'prefixNone',
+ }
+ export enum RemoveWordsIfNoResultsEnum {
+ None = 'none',
+ LastWords = 'lastWords',
+ FirstWords = 'firstWords',
+ AllOptional = 'allOptional',
+ }
+ export enum ExactOnSingleWordQueryEnum {
+ Attribute = 'attribute',
+ None = 'none',
+ Word = 'word',
+ }
+ export enum AlternativesAsExactEnum {
+ IgnorePlurals = 'ignorePlurals',
+ SingleWordSynonym = 'singleWordSynonym',
+ MultiWordsSynonym = 'multiWordsSynonym',
+ }
+ export enum AdvancedSyntaxFeaturesEnum {
+ ExactPhrase = 'exactPhrase',
+ ExcludeWords = 'excludeWords',
+ }
+}
diff --git a/output/model/singleQueryResponse.ts b/output/model/singleQueryResponse.ts
new file mode 100644
index 00000000000..873bb735892
--- /dev/null
+++ b/output/model/singleQueryResponse.ts
@@ -0,0 +1,233 @@
+import { RequestFile } from './models';
+import { Record } from './record';
+
+export class SingleQueryResponse {
+ /**
+ * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
+ */
+ 'abTestID'?: number;
+ /**
+ * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.
+ */
+ 'abTestVariantID'?: number;
+ /**
+ * The computed geo location.
+ */
+ 'aroundLatLng'?: string;
+ /**
+ * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.
+ */
+ 'automaticRadius'?: string;
+ /**
+ * Whether the facet count is exhaustive or approximate.
+ */
+ 'exhaustiveFacetsCount'?: boolean;
+ /**
+ * Indicate if the nbHits count was exhaustive or approximate
+ */
+ 'exhaustiveNbHits'?: boolean;
+ /**
+ * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)
+ */
+ 'exhaustiveTypo'?: boolean;
+ /**
+ * A mapping of each facet name to the corresponding facet counts.
+ */
+ 'facets'?: { [key: string]: { [key: string]: string } };
+ /**
+ * Statistics for numerical facets.
+ */
+ 'facetsStats'?: object;
+ 'hits'?: Array;
+ /**
+ * Set the number of hits per page.
+ */
+ 'hitsPerPage'?: number;
+ 'index'?: string;
+ /**
+ * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
+ */
+ 'indexUsed'?: string;
+ /**
+ * Used to return warnings about the query.
+ */
+ 'message'?: string;
+ /**
+ * Number of hits that the search query matched
+ */
+ 'nbHits'?: number;
+ /**
+ * Number of pages available for the current query
+ */
+ 'nbPages'?: number;
+ /**
+ * The number of hits selected and sorted by the relevant sort algorithm
+ */
+ 'nbSortedHits'?: number;
+ /**
+ * Specify the page to retrieve.
+ */
+ 'page'?: number;
+ /**
+ * A url-encoded string of all search parameters.
+ */
+ 'params'?: string;
+ /**
+ * The query string that will be searched, after normalization.
+ */
+ 'parsedQuery'?: string;
+ /**
+ * Time the server took to process the request, in milliseconds.
+ */
+ 'processingTimeMS'?: number;
+ /**
+ * The text to search in the index.
+ */
+ 'query'?: string;
+ /**
+ * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
+ */
+ 'queryAfterRemoval'?: string;
+ /**
+ * Actual host name of the server that processed the request.
+ */
+ 'serverUsed'?: string;
+ /**
+ * Lets you store custom data in your indices.
+ */
+ 'userData'?: { [key: string]: object };
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'abTestID',
+ baseName: 'abTestID',
+ type: 'number',
+ },
+ {
+ name: 'abTestVariantID',
+ baseName: 'abTestVariantID',
+ type: 'number',
+ },
+ {
+ name: 'aroundLatLng',
+ baseName: 'aroundLatLng',
+ type: 'string',
+ },
+ {
+ name: 'automaticRadius',
+ baseName: 'automaticRadius',
+ type: 'string',
+ },
+ {
+ name: 'exhaustiveFacetsCount',
+ baseName: 'exhaustiveFacetsCount',
+ type: 'boolean',
+ },
+ {
+ name: 'exhaustiveNbHits',
+ baseName: 'exhaustiveNbHits',
+ type: 'boolean',
+ },
+ {
+ name: 'exhaustiveTypo',
+ baseName: 'exhaustiveTypo',
+ type: 'boolean',
+ },
+ {
+ name: 'facets',
+ baseName: 'facets',
+ type: '{ [key: string]: { [key: string]: string; }; }',
+ },
+ {
+ name: 'facetsStats',
+ baseName: 'facets_stats',
+ type: 'object',
+ },
+ {
+ name: 'hits',
+ baseName: 'hits',
+ type: 'Array',
+ },
+ {
+ name: 'hitsPerPage',
+ baseName: 'hitsPerPage',
+ type: 'number',
+ },
+ {
+ name: 'index',
+ baseName: 'index',
+ type: 'string',
+ },
+ {
+ name: 'indexUsed',
+ baseName: 'indexUsed',
+ type: 'string',
+ },
+ {
+ name: 'message',
+ baseName: 'message',
+ type: 'string',
+ },
+ {
+ name: 'nbHits',
+ baseName: 'nbHits',
+ type: 'number',
+ },
+ {
+ name: 'nbPages',
+ baseName: 'nbPages',
+ type: 'number',
+ },
+ {
+ name: 'nbSortedHits',
+ baseName: 'nbSortedHits',
+ type: 'number',
+ },
+ {
+ name: 'page',
+ baseName: 'page',
+ type: 'number',
+ },
+ {
+ name: 'params',
+ baseName: 'params',
+ type: 'string',
+ },
+ {
+ name: 'parsedQuery',
+ baseName: 'parsedQuery',
+ type: 'string',
+ },
+ {
+ name: 'processingTimeMS',
+ baseName: 'processingTimeMS',
+ type: 'number',
+ },
+ {
+ name: 'query',
+ baseName: 'query',
+ type: 'string',
+ },
+ {
+ name: 'queryAfterRemoval',
+ baseName: 'queryAfterRemoval',
+ type: 'string',
+ },
+ {
+ name: 'serverUsed',
+ baseName: 'serverUsed',
+ type: 'string',
+ },
+ {
+ name: 'userData',
+ baseName: 'userData',
+ type: '{ [key: string]: object; }',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SingleQueryResponse.attributeTypeMap;
+ }
+}
diff --git a/output/model/singleQueryResponseHits.ts b/output/model/singleQueryResponseHits.ts
new file mode 100644
index 00000000000..e3088eb8624
--- /dev/null
+++ b/output/model/singleQueryResponseHits.ts
@@ -0,0 +1,22 @@
+import { RequestFile } from './models';
+
+export class SingleQueryResponseHits {
+ /**
+ * Unique identifier of the object
+ */
+ 'objectID'?: string;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'objectID',
+ baseName: 'objectID',
+ type: 'string',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SingleQueryResponseHits.attributeTypeMap;
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index e020c4dc5be..c62c72b0d6c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=f808d2&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=0457e2&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: dba0a04b72d61deb77746a2f982a29c4342cd356a1da83219a3438c6acd11fefafb06767956bfb1bfbcdd6226ff2739e874d769c0265b884723d5aafbcd8bb33
+ checksum: 571c3b30d032d593416ca90643783084c8530bbb2120c98f181c42db7c1377de8757fe8a75853a079cd7dd99f38123bff184e9d52db6ad35193709ad2db10862
languageName: node
linkType: hard
From 62cb6141437deff3608a8241b972e2ff064a16b4 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 16:54:03 +0100
Subject: [PATCH 05/11] build after merge
---
output/client-search/searchApi.ts | 36 +++++++++----------------------
yarn.lock | 4 ++--
2 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/output/client-search/searchApi.ts b/output/client-search/searchApi.ts
index c4fbc089442..bd72bdf489a 100644
--- a/output/client-search/searchApi.ts
+++ b/output/client-search/searchApi.ts
@@ -371,14 +371,10 @@ export class SearchApi {
/**
*
* @summary Get search results
- * @param xAlgoliaApplicationId Algolia appID
- * @param xAlgoliaAPIKey Algolia API key
* @param indexName The index in which to perform the request
* @param searchParams
*/
public async search(
- xAlgoliaApplicationId: string,
- xAlgoliaAPIKey: string,
indexName: string,
searchParams: SearchParams,
options: { headers: { [name: string]: string } } = { headers: {} }
@@ -400,20 +396,6 @@ export class SearchApi {
}
let localVarFormParams: any = {};
- // verify required parameter 'xAlgoliaApplicationId' is not null or undefined
- if (xAlgoliaApplicationId === null || xAlgoliaApplicationId === undefined) {
- throw new Error(
- 'Required parameter xAlgoliaApplicationId was null or undefined when calling search.'
- );
- }
-
- // verify required parameter 'xAlgoliaAPIKey' is not null or undefined
- if (xAlgoliaAPIKey === null || xAlgoliaAPIKey === undefined) {
- throw new Error(
- 'Required parameter xAlgoliaAPIKey was null or undefined when calling search.'
- );
- }
-
// verify required parameter 'indexName' is not null or undefined
if (indexName === null || indexName === undefined) {
throw new Error('Required parameter indexName was null or undefined when calling search.');
@@ -424,14 +406,6 @@ export class SearchApi {
throw new Error('Required parameter searchParams was null or undefined when calling search.');
}
- localVarHeaderParams['X-Algolia-Application-Id'] = ObjectSerializer.serialize(
- xAlgoliaApplicationId,
- 'string'
- );
- localVarHeaderParams['X-Algolia-API-Key'] = ObjectSerializer.serialize(
- xAlgoliaAPIKey,
- 'string'
- );
(Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
@@ -447,6 +421,16 @@ export class SearchApi {
};
let authenticationPromise = Promise.resolve();
+ if (this.authentications.apiKey.apiKey) {
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.apiKey.applyToRequest(localVarRequestOptions)
+ );
+ }
+ if (this.authentications.appId.apiKey) {
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.appId.applyToRequest(localVarRequestOptions)
+ );
+ }
authenticationPromise = authenticationPromise.then(() =>
this.authentications.default.applyToRequest(localVarRequestOptions)
);
diff --git a/yarn.lock b/yarn.lock
index f045c9fe69e..7ec9dbc172b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=e3d4a9&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=89d920&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: b10288eef0fc459225e5fd93462ac73ce44faa14ad71c8e525bfcbd1b72739a2043ba7fe9c7f2c2bf83ed940e6afd984e441883f4e007955ef8473d8061a2ab4
+ checksum: 8d48dcea213b4452fb1f5b14f41314007cf83e76b68ecebc2d9392297cb8a2aecad121a1c9ae24da0aefe6769dfe8de06b8d4d59d0738bcb337381013eea7a65
languageName: node
linkType: hard
From 0cdb5d48cb3c7983fd5a84acf0da357cec63bd6f Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 17:56:38 +0100
Subject: [PATCH 06/11] build clean
---
openapi_spec/schemas/RequestOptions.yml | 40 ++++++++++-----------
openapitools.json | 2 +-
output/model/inlineObject.ts | 36 -------------------
output/model/multipleQueriesResponseHits.ts | 22 ------------
output/model/requestOptions.ts | 27 --------------
output/model/requestOptionsHeaders.ts | 25 -------------
output/model/requestOptionsTimeouts.ts | 40 ---------------------
output/model/singleQueryResponseHits.ts | 22 ------------
yarn.lock | 4 +--
9 files changed, 23 insertions(+), 195 deletions(-)
delete mode 100644 output/model/inlineObject.ts
delete mode 100644 output/model/multipleQueriesResponseHits.ts
delete mode 100644 output/model/requestOptions.ts
delete mode 100644 output/model/requestOptionsHeaders.ts
delete mode 100644 output/model/requestOptionsTimeouts.ts
delete mode 100644 output/model/singleQueryResponseHits.ts
diff --git a/openapi_spec/schemas/RequestOptions.yml b/openapi_spec/schemas/RequestOptions.yml
index 5cca3c3f648..69762ce3bfc 100644
--- a/openapi_spec/schemas/RequestOptions.yml
+++ b/openapi_spec/schemas/RequestOptions.yml
@@ -1,23 +1,23 @@
# Not used yet
-timeouts:
- type: object
- additionalProperties: false
- properties:
- connect:
- type: integer
- description: 'Connection timeout in seconds.'
- example: 2
- read:
- type: integer
- description: 'Read timeout in seconds.'
- example: 5
- write:
- type: integer
- description: 'Write timeout in seconds.'
- example: 30
+# timeouts:
+# type: object
+# additionalProperties: false
+# properties:
+# connect:
+# type: integer
+# description: 'Connection timeout in seconds.'
+# example: 2
+# read:
+# type: integer
+# description: 'Read timeout in seconds.'
+# example: 5
+# write:
+# type: integer
+# description: 'Write timeout in seconds.'
+# example: 30
-X-Algolia-UserToken:
- type: string
-X-Forwarded-For:
- type: string
+# X-Algolia-UserToken:
+# type: string
+# X-Forwarded-For:
+# type: string
diff --git a/openapitools.json b/openapitools.json
index fb51cbe9232..b81b2813bb4 100644
--- a/openapitools.json
+++ b/openapitools.json
@@ -16,7 +16,7 @@
"gitUserId": "algolia",
"gitRepoId": "algoliasearch-client-javascript",
"additionalProperties": {
- "supportsES6": "true",
+ "supportsES6": true,
"npmName": "algoliasearch-client-javascript",
"npmVersion": "5.0.0"
}
diff --git a/output/model/inlineObject.ts b/output/model/inlineObject.ts
deleted file mode 100644
index cd3ae43af0d..00000000000
--- a/output/model/inlineObject.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { RequestFile } from './models';
-import { RequestOptions } from './requestOptions';
-import { SearchParams } from './searchParams';
-
-export class InlineObject {
- /**
- * The text to search in the index.
- */
- 'query'?: string;
- 'searchParameters'?: SearchParams;
- '_requestOptions'?: RequestOptions;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'query',
- baseName: 'query',
- type: 'string',
- },
- {
- name: 'searchParameters',
- baseName: 'searchParameters',
- type: 'SearchParams',
- },
- {
- name: '_requestOptions',
- baseName: 'requestOptions',
- type: 'RequestOptions',
- },
- ];
-
- static getAttributeTypeMap() {
- return InlineObject.attributeTypeMap;
- }
-}
diff --git a/output/model/multipleQueriesResponseHits.ts b/output/model/multipleQueriesResponseHits.ts
deleted file mode 100644
index 3e8178a67ac..00000000000
--- a/output/model/multipleQueriesResponseHits.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { RequestFile } from './models';
-
-export class MultipleQueriesResponseHits {
- /**
- * Unique identifier of the object
- */
- 'objectID'?: string;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'objectID',
- baseName: 'objectID',
- type: 'string',
- },
- ];
-
- static getAttributeTypeMap() {
- return MultipleQueriesResponseHits.attributeTypeMap;
- }
-}
diff --git a/output/model/requestOptions.ts b/output/model/requestOptions.ts
deleted file mode 100644
index 7033cb2f63c..00000000000
--- a/output/model/requestOptions.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { RequestFile } from './models';
-import { RequestOptionsHeaders } from './requestOptionsHeaders';
-import { RequestOptionsTimeouts } from './requestOptionsTimeouts';
-
-export class RequestOptions {
- 'headers'?: RequestOptionsHeaders;
- 'timeouts'?: RequestOptionsTimeouts;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'headers',
- baseName: 'headers',
- type: 'RequestOptionsHeaders',
- },
- {
- name: 'timeouts',
- baseName: 'timeouts',
- type: 'RequestOptionsTimeouts',
- },
- ];
-
- static getAttributeTypeMap() {
- return RequestOptions.attributeTypeMap;
- }
-}
diff --git a/output/model/requestOptionsHeaders.ts b/output/model/requestOptionsHeaders.ts
deleted file mode 100644
index 1e61c8b397d..00000000000
--- a/output/model/requestOptionsHeaders.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { RequestFile } from './models';
-
-export class RequestOptionsHeaders {
- 'xAlgoliaUserToken'?: string;
- 'xForwardedFor'?: string;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'xAlgoliaUserToken',
- baseName: 'X-Algolia-UserToken',
- type: 'string',
- },
- {
- name: 'xForwardedFor',
- baseName: 'X-Forwarded-For',
- type: 'string',
- },
- ];
-
- static getAttributeTypeMap() {
- return RequestOptionsHeaders.attributeTypeMap;
- }
-}
diff --git a/output/model/requestOptionsTimeouts.ts b/output/model/requestOptionsTimeouts.ts
deleted file mode 100644
index 1c43be46d63..00000000000
--- a/output/model/requestOptionsTimeouts.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { RequestFile } from './models';
-
-export class RequestOptionsTimeouts {
- /**
- * Connection timeout in seconds.
- */
- 'connect'?: number;
- /**
- * Read timeout in seconds.
- */
- 'read'?: number;
- /**
- * Write timeout in seconds.
- */
- 'write'?: number;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'connect',
- baseName: 'connect',
- type: 'number',
- },
- {
- name: 'read',
- baseName: 'read',
- type: 'number',
- },
- {
- name: 'write',
- baseName: 'write',
- type: 'number',
- },
- ];
-
- static getAttributeTypeMap() {
- return RequestOptionsTimeouts.attributeTypeMap;
- }
-}
diff --git a/output/model/singleQueryResponseHits.ts b/output/model/singleQueryResponseHits.ts
deleted file mode 100644
index e3088eb8624..00000000000
--- a/output/model/singleQueryResponseHits.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { RequestFile } from './models';
-
-export class SingleQueryResponseHits {
- /**
- * Unique identifier of the object
- */
- 'objectID'?: string;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'objectID',
- baseName: 'objectID',
- type: 'string',
- },
- ];
-
- static getAttributeTypeMap() {
- return SingleQueryResponseHits.attributeTypeMap;
- }
-}
diff --git a/yarn.lock b/yarn.lock
index 7ec9dbc172b..488adfe7e57 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=89d920&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=fe2bce&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 8d48dcea213b4452fb1f5b14f41314007cf83e76b68ecebc2d9392297cb8a2aecad121a1c9ae24da0aefe6769dfe8de06b8d4d59d0738bcb337381013eea7a65
+ checksum: 5c171f150beea91995d6569d7e8b0764e82255d3b6ede619bd68e7db1eced4d15f7fdd04de4e6b89a7b17f02e88002e4dfcb291f5694d99324e1336677efe9c8
languageName: node
linkType: hard
From 2bff5055cbafff0873a379a3f4b547577ed7a03b Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 18:11:26 +0100
Subject: [PATCH 07/11] more
---
.../paths/indexes/multipleQueries.yml | 2 +-
openapi_spec/paths/indexes/search.yml | 12 +-
openapi_spec/schemas/SearchParams.yml | 870 +++++++++---------
output/client-search/searchApi.ts | 18 +-
output/model/models.ts | 3 +
output/model/searchParamsString.ts | 19 +
yarn.lock | 4 +-
7 files changed, 483 insertions(+), 445 deletions(-)
create mode 100644 output/model/searchParamsString.ts
diff --git a/openapi_spec/paths/indexes/multipleQueries.yml b/openapi_spec/paths/indexes/multipleQueries.yml
index ea28448c20d..257f42078f4 100644
--- a/openapi_spec/paths/indexes/multipleQueries.yml
+++ b/openapi_spec/paths/indexes/multipleQueries.yml
@@ -24,7 +24,7 @@ post:
example: products
description: The Algolia index name
query:
- $ref: ../../schemas/SearchParams.yml#/properties/query
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/query
type:
type: string
enum: [default, facet]
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index f068ff3f12a..f7ece0e2b6c 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -10,7 +10,9 @@ post:
content:
application/json:
schema:
- $ref: ../../schemas/SearchParams.yml
+ oneOf:
+ - $ref: ../../schemas/SearchParams.yml#/searchParams
+ - $ref: ../../schemas/SearchParams.yml#/searchParamsString
responses:
'200':
description: OK
@@ -65,7 +67,7 @@ post:
items:
$ref: ../../schemas/Record.yml#/record
hitsPerPage:
- $ref: ../../schemas/SearchParams.yml#/properties/hitsPerPage
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/hitsPerPage
index:
type: string
example: indexName
@@ -87,7 +89,7 @@ post:
type: integer
description: The number of hits selected and sorted by the relevant sort algorithm
page:
- $ref: ../../schemas/SearchParams.yml#/properties/page
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/page
params:
type: string
description: A url-encoded string of all search parameters.
@@ -100,7 +102,7 @@ post:
description: Time the server took to process the request, in milliseconds.
example: 20
query:
- $ref: ../../schemas/SearchParams.yml#/properties/query
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/query
queryAfterRemoval:
type: string
description: A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
@@ -108,7 +110,7 @@ post:
type: string
description: Actual host name of the server that processed the request.
userData:
- $ref: ../../schemas/SearchParams.yml#/properties/userData
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/userData
# Other codes
'400':
diff --git a/openapi_spec/schemas/SearchParams.yml b/openapi_spec/schemas/SearchParams.yml
index 4dfa2cd3450..411dc99e055 100644
--- a/openapi_spec/schemas/SearchParams.yml
+++ b/openapi_spec/schemas/SearchParams.yml
@@ -1,451 +1,459 @@
-type: object
-additionalProperties: false
-properties:
- query:
- type: string
- description: The text to search in the index.
- default: ''
- similarQuery:
- type: string
- description: Overrides the query parameter and performs a more generic search that can be used to find "similar" results.
- default: ''
- searchableAttributes:
- type: array
- items:
+searchParams:
+ type: object
+ additionalProperties: false
+ properties:
+ query:
type: string
- description: The complete list of attributes used for searching.
- default: []
- attributesForFaceting:
- type: array
- items:
+ description: The text to search in the index.
+ default: ''
+ similarQuery:
type: string
- description: The complete list of attributes that will be used for faceting.
- default: []
- unretrievableAttributes:
- type: array
- items:
+ description: Overrides the query parameter and performs a more generic search that can be used to find "similar" results.
+ default: ''
+ searchableAttributes:
+ type: array
+ items:
+ type: string
+ description: The complete list of attributes used for searching.
+ default: []
+ attributesForFaceting:
+ type: array
+ items:
+ type: string
+ description: The complete list of attributes that will be used for faceting.
+ default: []
+ unretrievableAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes that can’t be retrieved at query time.
+ default: []
+ attributesToRetrieve:
+ type: array
+ items:
+ type: string
+ description: This parameter controls which attributes to retrieve and which not to retrieve.
+ default: ['*']
+ restrictSearchableAttributes:
+ type: array
+ items:
+ type: string
+ description: Restricts a given query to look in only a subset of your searchable attributes.
+ default: []
+ ranking:
+ type: array
+ items:
+ type: string
+ description: Controls how Algolia should sort your results.
+ default:
+ - 'typo'
+ - 'geo'
+ - 'words'
+ - 'filters'
+ - 'proximity'
+ - 'attribute'
+ - 'exact'
+ - 'custom'
+ customRanking:
+ type: array
+ items:
+ type: string
+ description: Specifies the custom ranking criterion.
+ default: []
+ relevancyStrictness:
+ type: integer
+ description: Controls the relevancy threshold below which less relevant results aren’t included in the results.
+ default: 100
+ replicas:
+ type: array
+ items:
+ type: string
+ description: Creates replicas, exact copies of an index.
+ default: []
+ filters:
type: string
- description: List of attributes that can’t be retrieved at query time.
- default: []
- attributesToRetrieve:
- type: array
- items:
+ description: Filter the query with numeric, facet and/or tag filters.
+ default: ''
+ # There could be a pattern for this one (complicated one)
+ facetFilters:
+ type: array
+ items:
+ type: string
+ description: Filter hits by facet value.
+ default: []
+ optionalFilters:
+ type: array
+ items:
+ type: string
+ description: Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.
+ default: []
+ numericFilters:
+ type: array
+ items:
+ type: string
+ description: Filter on numeric attributes.
+ default: []
+ tagFilters:
+ type: array
+ items:
+ type: string
+ description: Filter hits by tags.
+ default: []
+ sumOrFiltersScores:
+ type: boolean
+ description: Determines how to calculate the total score for filtering.
+ default: false
+ facets:
+ type: array
+ items:
+ type: string
+ description: Retrieve facets and their facet values.
+ default: []
+ maxValuesPerFacet:
+ type: integer
+ description: Maximum number of facet values to return for each facet during a regular search.
+ default: 100
+ facetingAfterDistinct:
+ type: boolean
+ description: Force faceting to be applied after de-duplication (via the Distinct setting).
+ default: false
+ sortFacetValuesBy:
type: string
- description: This parameter controls which attributes to retrieve and which not to retrieve.
- default: ['*']
- restrictSearchableAttributes:
- type: array
- items:
+ description: Controls how facet values are fetched.
+ default: 'count'
+ attributesToHighlight:
+ type: array
+ items:
+ type: string
+ description: List of attributes to highlight.
+ attributesToSnippet:
+ type: array
+ items:
+ type: string
+ description: List of attributes to snippet, with an optional maximum number of words to snippet.
+ default: []
+ highlightPreTag:
type: string
- description: Restricts a given query to look in only a subset of your searchable attributes.
- default: []
- ranking:
- type: array
- items:
+ description: The HTML string to insert before the highlighted parts in all highlight and snippet results.
+ default: ''
+ highlightPostTag:
type: string
- description: Controls how Algolia should sort your results.
- default:
- - 'typo'
- - 'geo'
- - 'words'
- - 'filters'
- - 'proximity'
- - 'attribute'
- - 'exact'
- - 'custom'
- customRanking:
- type: array
- items:
+ description: The HTML string to insert after the highlighted parts in all highlight and snippet results.
+ default: ''
+ snippetEllipsisText:
type: string
- description: Specifies the custom ranking criterion.
- default: []
- relevancyStrictness:
- type: integer
- description: Controls the relevancy threshold below which less relevant results aren’t included in the results.
- default: 100
- replicas:
- type: array
- items:
+ description: String used as an ellipsis indicator when a snippet is truncated.
+ default: '…'
+ restrictHighlightAndSnippetArrays:
+ type: boolean
+ description: Restrict highlighting and snippeting to items that matched the query.
+ default: false
+ page:
+ type: integer
+ description: Specify the page to retrieve.
+ default: 0
+ hitsPerPage:
+ type: integer
+ description: Set the number of hits per page.
+ default: 20
+ offset:
+ type: integer
+ description: Specify the offset of the first hit to return.
+ default: null
+ length:
+ type: integer
+ description: Set the number of hits to retrieve (used only with offset).
+ default: null
+ paginationLimitedTo:
+ type: integer
+ description: Set the maximum number of hits accessible via pagination.
+ default: 1000
+ minWordSizefor1Typo:
+ type: integer
+ description: Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
+ default: 4
+ minWordSizefor2Typos:
+ type: integer
+ description: Minimum number of characters a word in the query string must contain to accept matches with 2 typos.
+ default: 8
+ typoTolerance:
type: string
- description: Creates replicas, exact copies of an index.
- default: []
- filters:
- type: string
- description: Filter the query with numeric, facet and/or tag filters.
- default: ''
- # There could be a pattern for this one (complicated one)
- facetFilters:
- type: array
- items:
+ enum: [true, false, 'min', 'strict']
+ description: Controls whether typo tolerance is enabled and how it is applied.
+ default: true
+ allowTyposOnNumericTokens:
+ type: boolean
+ description: Whether to allow typos on numbers (“numeric tokens”) in the query string.
+ default: true
+ disableTypoToleranceOnAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which you want to disable typo tolerance.
+ default: []
+ disableTypoToleranceOnWords:
+ type: array
+ items:
+ type: string
+ description: A list of words for which you want to turn off typo tolerance.
+ default: []
+ separatorsToIndex:
type: string
- description: Filter hits by facet value.
- default: []
- optionalFilters:
- type: array
- items:
+ description: Control which separators are indexed.
+ default: ''
+ aroundLatLng:
type: string
- description: Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.
- default: []
- numericFilters:
- type: array
- items:
+ description: Search for entries around a central geolocation, enabling a geo search within a circular area.
+ default: null
+ aroundLatLngViaIP:
+ type: boolean
+ description: Search for entries around a given location automatically computed from the requester’s IP address.
+ default: false
+ aroundRadius:
type: string
- description: Filter on numeric attributes.
- default: []
- tagFilters:
- type: array
- items:
+ description: Define the maximum radius for a geo search (in meters).
+ default: null
+ aroundPrecision:
+ type: integer
+ description: Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
+ default: 10
+ minimumAroundRadius:
+ type: integer
+ description: Minimum radius (in meters) used for a geo search when aroundRadius is not set.
+ default: null
+ insideBoundingBox:
+ type: array
+ items:
+ type: number
+ description: Search inside a rectangular area (in geo coordinates).
+ default: null
+ insidePolygon:
+ type: array
+ items:
+ type: number
+ description: Search inside a polygon (in geo coordinates).
+ default: null
+ ignorePlurals:
type: string
- description: Filter hits by tags.
- default: []
- sumOrFiltersScores:
- type: boolean
- description: Determines how to calculate the total score for filtering.
- default: false
- facets:
- type: array
- items:
+ description: Treats singular, plurals, and other forms of declensions as matching terms.
+ default: false
+ attributesToTransliterate:
+ type: array
+ items:
+ type: string
+ description: Specify on which attributes to apply transliteration.
+ removeStopWords:
type: string
- description: Retrieve facets and their facet values.
- default: []
- maxValuesPerFacet:
- type: integer
- description: Maximum number of facet values to return for each facet during a regular search.
- default: 100
- facetingAfterDistinct:
- type: boolean
- description: Force faceting to be applied after de-duplication (via the Distinct setting).
- default: false
- sortFacetValuesBy:
- type: string
- description: Controls how facet values are fetched.
- default: 'count'
- attributesToHighlight:
- type: array
- items:
+ description: Removes stop (common) words from the query before executing it.
+ default: false
+ camelCaseAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which to do a decomposition of camel case words.
+ default: []
+ decompoundedAttributes:
+ type: object
+ additionalProperties: true
+ description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
+ default: {}
+ keepDiacriticsOnCharacters:
type: string
- description: List of attributes to highlight.
- attributesToSnippet:
- type: array
- items:
+ description: List of characters that the engine shouldn’t automatically normalize.
+ default: ''
+ customNormalization:
+ type: object
+ additionalProperties: true
+ description: Override the default normalization handled by the engine.
+ default: {}
+ queryLanguages:
+ type: array
+ items:
+ type: string
+ description: Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
+ default: []
+ indexLanguages:
+ type: array
+ items:
+ type: string
+ description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
+ default: []
+ naturalLanguages:
+ type: array
+ items:
+ type: string
+ description: This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.
+ default: []
+ decompoundQuery:
+ type: boolean
+ description: Splits compound words into their composing atoms in the query.
+ default: true
+ enableRules:
+ type: boolean
+ description: Whether Rules should be globally enabled.
+ default: true
+ filterPromotes:
+ type: boolean
+ description: Whether promoted results should match the filters of the current search, except for geographic filters.
+ default: false
+ ruleContexts:
+ type: array
+ items:
+ type: string
+ description: Enables contextual rules.
+ default: []
+ enablePersonalization:
+ type: boolean
+ description: Enable the Personalization feature.
+ default: false
+ personalizationImpact:
+ type: integer
+ description: Define the impact of the Personalization feature.
+ default: 100
+ userToken:
type: string
- description: List of attributes to snippet, with an optional maximum number of words to snippet.
- default: []
- highlightPreTag:
- type: string
- description: The HTML string to insert before the highlighted parts in all highlight and snippet results.
- default: ''
- highlightPostTag:
- type: string
- description: The HTML string to insert after the highlighted parts in all highlight and snippet results.
- default: ''
- snippetEllipsisText:
- type: string
- description: String used as an ellipsis indicator when a snippet is truncated.
- default: '…'
- restrictHighlightAndSnippetArrays:
- type: boolean
- description: Restrict highlighting and snippeting to items that matched the query.
- default: false
- page:
- type: integer
- description: Specify the page to retrieve.
- default: 0
- hitsPerPage:
- type: integer
- description: Set the number of hits per page.
- default: 20
- offset:
- type: integer
- description: Specify the offset of the first hit to return.
- default: null
- length:
- type: integer
- description: Set the number of hits to retrieve (used only with offset).
- default: null
- paginationLimitedTo:
- type: integer
- description: Set the maximum number of hits accessible via pagination.
- default: 1000
- minWordSizefor1Typo:
- type: integer
- description: Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
- default: 4
- minWordSizefor2Typos:
- type: integer
- description: Minimum number of characters a word in the query string must contain to accept matches with 2 typos.
- default: 8
- typoTolerance:
- type: string
- enum: [true, false, 'min', 'strict']
- description: Controls whether typo tolerance is enabled and how it is applied.
- default: true
- allowTyposOnNumericTokens:
- type: boolean
- description: Whether to allow typos on numbers (“numeric tokens”) in the query string.
- default: true
- disableTypoToleranceOnAttributes:
- type: array
- items:
+ description: Associates a certain user token with the current search.
+ queryType:
type: string
- description: List of attributes on which you want to disable typo tolerance.
- default: []
- disableTypoToleranceOnWords:
- type: array
- items:
+ enum: ['prefixLast', 'prefixAll', 'prefixNone']
+ description: Controls if and how query words are interpreted as prefixes.
+ default: 'prefixLast'
+ removeWordsIfNoResults:
type: string
- description: A list of words for which you want to turn off typo tolerance.
- default: []
- separatorsToIndex:
- type: string
- description: Control which separators are indexed.
- default: ''
- aroundLatLng:
- type: string
- description: Search for entries around a central geolocation, enabling a geo search within a circular area.
- default: null
- aroundLatLngViaIP:
- type: boolean
- description: Search for entries around a given location automatically computed from the requester’s IP address.
- default: false
- aroundRadius:
- type: string
- description: Define the maximum radius for a geo search (in meters).
- default: null
- aroundPrecision:
- type: integer
- description: Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
- default: 10
- minimumAroundRadius:
- type: integer
- description: Minimum radius (in meters) used for a geo search when aroundRadius is not set.
- default: null
- insideBoundingBox:
- type: array
- items:
- type: number
- description: Search inside a rectangular area (in geo coordinates).
- default: null
- insidePolygon:
- type: array
- items:
- type: number
- description: Search inside a polygon (in geo coordinates).
- default: null
- ignorePlurals:
- type: string
- description: Treats singular, plurals, and other forms of declensions as matching terms.
- default: false
- attributesToTransliterate:
- type: array
- items:
+ enum: ['none', 'lastWords', 'firstWords', 'allOptional']
+ description: Selects a strategy to remove words from the query when it doesn’t match any hits.
+ default: 'none'
+ advancedSyntax:
+ type: boolean
+ description: Enables the advanced query syntax.
+ default: false
+ optionalWords:
+ type: array
+ items:
+ type: string
+ description: A list of words that should be considered as optional when found in the query.
+ default: []
+ disablePrefixOnAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which you want to disable prefix matching.
+ default: []
+ disableExactOnAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which you want to disable the exact ranking criterion.
+ default: []
+ exactOnSingleWordQuery:
type: string
- description: Specify on which attributes to apply transliteration.
- removeStopWords:
- type: string
- description: Removes stop (common) words from the query before executing it.
- default: false
- camelCaseAttributes:
- type: array
- items:
+ enum: ['attribute', 'none', 'word']
+ description: Controls how the exact ranking criterion is computed when the query contains only one word.
+ default: 'attribute'
+ alternativesAsExact:
+ type: array
+ items:
+ type: string
+ enum: ['ignorePlurals', 'singleWordSynonym', 'multiWordsSynonym']
+ description: List of alternatives that should be considered an exact match by the exact ranking criterion.
+ default: ['ignorePlurals', 'singleWordSynonym']
+ advancedSyntaxFeatures:
+ type: array
+ items:
+ type: string
+ enum: ['exactPhrase', 'excludeWords']
+ description: Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.
+ default: ['exactPhrase', 'excludeWords']
+ numericAttributesForFiltering:
+ type: array
+ items:
+ type: string
+ description: List of numeric attributes that can be used as numerical filters.
+ default: null
+ allowCompressionOfIntegerArray:
+ type: boolean
+ description: Enables compression of large integer arrays.
+ default: false
+ attributeForDistinct:
type: string
- description: List of attributes on which to do a decomposition of camel case words.
- default: []
- decompoundedAttributes:
- type: object
- additionalProperties: true
- description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
- default: {}
- keepDiacriticsOnCharacters:
- type: string
- description: List of characters that the engine shouldn’t automatically normalize.
- default: ''
- customNormalization:
- type: object
- additionalProperties: true
- description: Override the default normalization handled by the engine.
- default: {}
- queryLanguages:
- type: array
- items:
+ description: Name of the de-duplication attribute to be used with the distinct feature.
+ default: null
+ distinct:
+ type: integer
+ minimum: 0
+ maximum: 4
+ description: Enables de-duplication or grouping of results.
+ default: 0
+ getRankingInfo:
+ type: boolean
+ description: Retrieve detailed ranking information.
+ default: false
+ clickAnalytics:
+ type: boolean
+ description: Enable the Click Analytics feature.
+ default: false
+ analytics:
+ type: boolean
+ description: Whether the current query will be taken into account in the Analytics.
+ default: true
+ analyticsTags:
+ type: array
+ items:
+ type: string
+ description: List of tags to apply to the query for analytics purposes.
+ default: []
+ synonyms:
+ type: boolean
+ description: Whether to take into account an index’s synonyms for a particular search.
+ default: true
+ replaceSynonymsInHighlight:
+ type: boolean
+ description: Whether to highlight and snippet the original word that matches the synonym or the synonym itself.
+ default: false
+ minProximity:
+ type: integer
+ minimum: 1
+ maximum: 7
+ description: Precision of the proximity ranking criterion.
+ default: 1
+ responseFields:
+ type: array
+ items:
+ type: string
+ description: Choose which fields to return in the API response. This parameters applies to search and browse queries.
+ maxFacetHits:
+ type: integer
+ description: Maximum number of facet hits to return during a search for facet values.
+ default: 10
+ percentileComputation:
+ type: boolean
+ description: Whether to include or exclude a query from the processing-time percentile computation.
+ default: true
+ attributeCriteriaComputedByMinProximity:
+ type: boolean
+ description: When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
+ default: false
+ userData:
+ type: object
+ additionalProperties: true
+ description: Lets you store custom data in your indices.
+ default: {}
+ enableABTest:
+ type: boolean
+ description: Whether this search should participate in running AB tests.
+ default: true
+ enableReRanking:
+ type: boolean
+ description: Whether this search should use AI Re-Ranking.
+ default: true
+ renderingContent:
+ type: object
+ description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
+ default: {}
+
+searchParamsString:
+ type: object
+ additionalProperties: false
+ properties:
+ params:
type: string
- description: Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
- default: []
- indexLanguages:
- type: array
- items:
- type: string
- description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
- default: []
- naturalLanguages:
- type: array
- items:
- type: string
- description: This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.
- default: []
- decompoundQuery:
- type: boolean
- description: Splits compound words into their composing atoms in the query.
- default: true
- enableRules:
- type: boolean
- description: Whether Rules should be globally enabled.
- default: true
- filterPromotes:
- type: boolean
- description: Whether promoted results should match the filters of the current search, except for geographic filters.
- default: false
- ruleContexts:
- type: array
- items:
- type: string
- description: Enables contextual rules.
- default: []
- enablePersonalization:
- type: boolean
- description: Enable the Personalization feature.
- default: false
- personalizationImpact:
- type: integer
- description: Define the impact of the Personalization feature.
- default: 100
- userToken:
- type: string
- description: Associates a certain user token with the current search.
- queryType:
- type: string
- enum: ['prefixLast', 'prefixAll', 'prefixNone']
- description: Controls if and how query words are interpreted as prefixes.
- default: 'prefixLast'
- removeWordsIfNoResults:
- type: string
- enum: ['none', 'lastWords', 'firstWords', 'allOptional']
- description: Selects a strategy to remove words from the query when it doesn’t match any hits.
- default: 'none'
- advancedSyntax:
- type: boolean
- description: Enables the advanced query syntax.
- default: false
- optionalWords:
- type: array
- items:
- type: string
- description: A list of words that should be considered as optional when found in the query.
- default: []
- disablePrefixOnAttributes:
- type: array
- items:
- type: string
- description: List of attributes on which you want to disable prefix matching.
- default: []
- disableExactOnAttributes:
- type: array
- items:
- type: string
- description: List of attributes on which you want to disable the exact ranking criterion.
- default: []
- exactOnSingleWordQuery:
- type: string
- enum: ['attribute', 'none', 'word']
- description: Controls how the exact ranking criterion is computed when the query contains only one word.
- default: 'attribute'
- alternativesAsExact:
- type: array
- items:
- type: string
- enum: ['ignorePlurals', 'singleWordSynonym', 'multiWordsSynonym']
- description: List of alternatives that should be considered an exact match by the exact ranking criterion.
- default: ['ignorePlurals', 'singleWordSynonym']
- advancedSyntaxFeatures:
- type: array
- items:
- type: string
- enum: ['exactPhrase', 'excludeWords']
- description: Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.
- default: ['exactPhrase', 'excludeWords']
- numericAttributesForFiltering:
- type: array
- items:
- type: string
- description: List of numeric attributes that can be used as numerical filters.
- default: null
- allowCompressionOfIntegerArray:
- type: boolean
- description: Enables compression of large integer arrays.
- default: false
- attributeForDistinct:
- type: string
- description: Name of the de-duplication attribute to be used with the distinct feature.
- default: null
- distinct:
- type: integer
- minimum: 0
- maximum: 4
- description: Enables de-duplication or grouping of results.
- default: 0
- getRankingInfo:
- type: boolean
- description: Retrieve detailed ranking information.
- default: false
- clickAnalytics:
- type: boolean
- description: Enable the Click Analytics feature.
- default: false
- analytics:
- type: boolean
- description: Whether the current query will be taken into account in the Analytics.
- default: true
- analyticsTags:
- type: array
- items:
- type: string
- description: List of tags to apply to the query for analytics purposes.
- default: []
- synonyms:
- type: boolean
- description: Whether to take into account an index’s synonyms for a particular search.
- default: true
- replaceSynonymsInHighlight:
- type: boolean
- description: Whether to highlight and snippet the original word that matches the synonym or the synonym itself.
- default: false
- minProximity:
- type: integer
- minimum: 1
- maximum: 7
- description: Precision of the proximity ranking criterion.
- default: 1
- responseFields:
- type: array
- items:
- type: string
- description: Choose which fields to return in the API response. This parameters applies to search and browse queries.
- maxFacetHits:
- type: integer
- description: Maximum number of facet hits to return during a search for facet values.
- default: 10
- percentileComputation:
- type: boolean
- description: Whether to include or exclude a query from the processing-time percentile computation.
- default: true
- attributeCriteriaComputedByMinProximity:
- type: boolean
- description: When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
- default: false
- userData:
- type: object
- additionalProperties: true
- description: Lets you store custom data in your indices.
- default: {}
- enableABTest:
- type: boolean
- description: Whether this search should participate in running AB tests.
- default: true
- enableReRanking:
- type: boolean
- description: Whether this search should use AI Re-Ranking.
- default: true
- renderingContent:
- type: object
- description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
- default: {}
diff --git a/output/client-search/searchApi.ts b/output/client-search/searchApi.ts
index bd72bdf489a..269cb5ff003 100644
--- a/output/client-search/searchApi.ts
+++ b/output/client-search/searchApi.ts
@@ -7,6 +7,7 @@ import { MultipleQueriesObject } from '../model/multipleQueriesObject';
import { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
import { SaveObjectResponse } from '../model/saveObjectResponse';
import { SearchParams } from '../model/searchParams';
+import { SearchParamsString } from '../model/searchParamsString';
import { SingleQueryResponse } from '../model/singleQueryResponse';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
@@ -372,11 +373,11 @@ export class SearchApi {
*
* @summary Get search results
* @param indexName The index in which to perform the request
- * @param searchParams
+ * @param searchParamsSearchParamsString
*/
public async search(
indexName: string,
- searchParams: SearchParams,
+ searchParamsSearchParamsString: SearchParams | SearchParamsString,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: SingleQueryResponse }> {
const localVarPath =
@@ -401,9 +402,11 @@ export class SearchApi {
throw new Error('Required parameter indexName was null or undefined when calling search.');
}
- // verify required parameter 'searchParams' is not null or undefined
- if (searchParams === null || searchParams === undefined) {
- throw new Error('Required parameter searchParams was null or undefined when calling search.');
+ // verify required parameter 'searchParamsSearchParamsString' is not null or undefined
+ if (searchParamsSearchParamsString === null || searchParamsSearchParamsString === undefined) {
+ throw new Error(
+ 'Required parameter searchParamsSearchParamsString was null or undefined when calling search.'
+ );
}
(Object).assign(localVarHeaderParams, options.headers);
@@ -417,7 +420,10 @@ export class SearchApi {
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
- body: ObjectSerializer.serialize(searchParams, 'SearchParams'),
+ body: ObjectSerializer.serialize(
+ searchParamsSearchParamsString,
+ 'SearchParams | SearchParamsString'
+ ),
};
let authenticationPromise = Promise.resolve();
diff --git a/output/model/models.ts b/output/model/models.ts
index 37848617f3f..58bf74dbf82 100644
--- a/output/model/models.ts
+++ b/output/model/models.ts
@@ -11,6 +11,7 @@ export * from './operation';
export * from './record';
export * from './saveObjectResponse';
export * from './searchParams';
+export * from './searchParamsString';
export * from './singleQueryResponse';
import * as fs from 'fs';
@@ -36,6 +37,7 @@ import { Operation } from './operation';
import { Record } from './record';
import { SaveObjectResponse } from './saveObjectResponse';
import { SearchParams } from './searchParams';
+import { SearchParamsString } from './searchParamsString';
import { SingleQueryResponse } from './singleQueryResponse';
let primitives = ['string', 'boolean', 'double', 'integer', 'long', 'float', 'number', 'any'];
@@ -64,6 +66,7 @@ let typeMap: { [index: string]: any } = {
Record: Record,
SaveObjectResponse: SaveObjectResponse,
SearchParams: SearchParams,
+ SearchParamsString: SearchParamsString,
SingleQueryResponse: SingleQueryResponse,
};
diff --git a/output/model/searchParamsString.ts b/output/model/searchParamsString.ts
new file mode 100644
index 00000000000..d64b7587efc
--- /dev/null
+++ b/output/model/searchParamsString.ts
@@ -0,0 +1,19 @@
+import { RequestFile } from './models';
+
+export class SearchParamsString {
+ 'params'?: string;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'params',
+ baseName: 'params',
+ type: 'string',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SearchParamsString.attributeTypeMap;
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index 488adfe7e57..18627fa2f1e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=fe2bce&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=4ffd32&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 5c171f150beea91995d6569d7e8b0764e82255d3b6ede619bd68e7db1eced4d15f7fdd04de4e6b89a7b17f02e88002e4dfcb291f5694d99324e1336677efe9c8
+ checksum: 084b17d9a63a13b0bb325ed64fc6ef18ec64212498dc9084b23ef3bd846cb9c9fbac6a10f8489e0c489ce2a68f3e54c8b69ad29980803be159f74e7ad622e5cb
languageName: node
linkType: hard
From 2d131d3e5dd1bb58160692831e0d079c4295c122 Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 18:19:20 +0100
Subject: [PATCH 08/11] more
---
openapi_spec/paths/indexes/search.yml | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index f7ece0e2b6c..5b1ad968a1b 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -53,10 +53,9 @@ post:
type: string
description: A mapping of each facet name to the corresponding facet counts.
example:
- facets:
- category:
- food: 1
- tech: 42
+ category:
+ food: 1
+ tech: 42
facets_stats:
type: object
description: Statistics for numerical facets.
@@ -74,6 +73,7 @@ post:
indexUsed:
type: string
description: Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
+ example: indexNameAlt
message:
type: string
description: Used to return warnings about the query.
@@ -88,6 +88,7 @@ post:
nbSortedHits:
type: integer
description: The number of hits selected and sorted by the relevant sort algorithm
+ example: 20
page:
$ref: ../../schemas/SearchParams.yml#/searchParams/properties/page
params:
From 991a9e592db7f417070e757c88caae5570313e7b Mon Sep 17 00:00:00 2001
From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Date: Mon, 15 Nov 2021 21:16:49 +0100
Subject: [PATCH 09/11] almost there
---
openapi_spec/paths/indexes/search.yml | 2 +-
openapi_spec/schemas/SearchParams.yml | 181 +++++++++++++++-----------
output/model/searchParams.ts | 135 +------------------
yarn.lock | 4 +-
4 files changed, 108 insertions(+), 214 deletions(-)
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index 5b1ad968a1b..44414654596 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -111,7 +111,7 @@ post:
type: string
description: Actual host name of the server that processed the request.
userData:
- $ref: ../../schemas/SearchParams.yml#/searchParams/properties/userData
+ $ref: ../../schemas/SearchParams.yml#/userData
# Other codes
'400':
diff --git a/openapi_spec/schemas/SearchParams.yml b/openapi_spec/schemas/SearchParams.yml
index 411dc99e055..5a7d5f7911f 100644
--- a/openapi_spec/schemas/SearchParams.yml
+++ b/openapi_spec/schemas/SearchParams.yml
@@ -1,6 +1,8 @@
searchParams:
type: object
additionalProperties: false
+ required:
+ - query
properties:
query:
type: string
@@ -64,12 +66,6 @@ searchParams:
type: integer
description: Controls the relevancy threshold below which less relevant results aren’t included in the results.
default: 100
- replicas:
- type: array
- items:
- type: string
- description: Creates replicas, exact copies of an index.
- default: []
filters:
type: string
description: Filter the query with numeric, facet and/or tag filters.
@@ -159,15 +155,11 @@ searchParams:
offset:
type: integer
description: Specify the offset of the first hit to return.
- default: null
length:
type: integer
description: Set the number of hits to retrieve (used only with offset).
- default: null
- paginationLimitedTo:
- type: integer
- description: Set the maximum number of hits accessible via pagination.
- default: 1000
+ minimum: 1
+ maximum: 1000
minWordSizefor1Typo:
type: integer
description: Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
@@ -191,12 +183,6 @@ searchParams:
type: string
description: List of attributes on which you want to disable typo tolerance.
default: []
- disableTypoToleranceOnWords:
- type: array
- items:
- type: string
- description: A list of words for which you want to turn off typo tolerance.
- default: []
separatorsToIndex:
type: string
description: Control which separators are indexed.
@@ -204,15 +190,18 @@ searchParams:
aroundLatLng:
type: string
description: Search for entries around a central geolocation, enabling a geo search within a circular area.
- default: null
+ default: ''
aroundLatLngViaIP:
type: boolean
description: Search for entries around a given location automatically computed from the requester’s IP address.
default: false
aroundRadius:
- type: string
- description: Define the maximum radius for a geo search (in meters).
- default: null
+ oneOf:
+ - type: integer
+ description: Define the maximum radius for a geo search (in meters).
+ minimum: 1
+ - type: string
+ enum: [all]
aroundPrecision:
type: integer
description: Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
@@ -220,7 +209,7 @@ searchParams:
minimumAroundRadius:
type: integer
description: Minimum radius (in meters) used for a geo search when aroundRadius is not set.
- default: null
+ minimum: 1
insideBoundingBox:
type: array
items:
@@ -237,47 +226,20 @@ searchParams:
type: string
description: Treats singular, plurals, and other forms of declensions as matching terms.
default: false
- attributesToTransliterate:
- type: array
- items:
- type: string
- description: Specify on which attributes to apply transliteration.
removeStopWords:
type: string
description: Removes stop (common) words from the query before executing it.
default: false
- camelCaseAttributes:
- type: array
- items:
- type: string
- description: List of attributes on which to do a decomposition of camel case words.
- default: []
- decompoundedAttributes:
- type: object
- additionalProperties: true
- description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
- default: {}
keepDiacriticsOnCharacters:
type: string
description: List of characters that the engine shouldn’t automatically normalize.
default: ''
- customNormalization:
- type: object
- additionalProperties: true
- description: Override the default normalization handled by the engine.
- default: {}
queryLanguages:
type: array
items:
type: string
description: Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
default: []
- indexLanguages:
- type: array
- items:
- type: string
- description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
- default: []
naturalLanguages:
type: array
items:
@@ -292,10 +254,6 @@ searchParams:
type: boolean
description: Whether Rules should be globally enabled.
default: true
- filterPromotes:
- type: boolean
- description: Whether promoted results should match the filters of the current search, except for geographic filters.
- default: false
ruleContexts:
type: array
items:
@@ -333,12 +291,6 @@ searchParams:
type: string
description: A list of words that should be considered as optional when found in the query.
default: []
- disablePrefixOnAttributes:
- type: array
- items:
- type: string
- description: List of attributes on which you want to disable prefix matching.
- default: []
disableExactOnAttributes:
type: array
items:
@@ -364,20 +316,6 @@ searchParams:
enum: ['exactPhrase', 'excludeWords']
description: Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.
default: ['exactPhrase', 'excludeWords']
- numericAttributesForFiltering:
- type: array
- items:
- type: string
- description: List of numeric attributes that can be used as numerical filters.
- default: null
- allowCompressionOfIntegerArray:
- type: boolean
- description: Enables compression of large integer arrays.
- default: false
- attributeForDistinct:
- type: string
- description: Name of the de-duplication attribute to be used with the distinct feature.
- default: null
distinct:
type: integer
minimum: 0
@@ -421,6 +359,7 @@ searchParams:
items:
type: string
description: Choose which fields to return in the API response. This parameters applies to search and browse queries.
+ default: []
maxFacetHits:
type: integer
description: Maximum number of facet hits to return during a search for facet values.
@@ -433,11 +372,6 @@ searchParams:
type: boolean
description: When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
default: false
- userData:
- type: object
- additionalProperties: true
- description: Lets you store custom data in your indices.
- default: {}
enableABTest:
type: boolean
description: Whether this search should participate in running AB tests.
@@ -457,3 +391,92 @@ searchParamsString:
properties:
params:
type: string
+
+# Not search related
+# TODO: move elsewhere
+
+allowCompressionOfIntegerArray:
+ type: boolean
+ description: Enables compression of large integer arrays.
+ default: false
+
+attributeForDistinct:
+ type: string
+ description: Name of the de-duplication attribute to be used with the distinct feature.
+ default: null
+
+attributesToTransliterate:
+ type: array
+ items:
+ type: string
+ description: Specify on which attributes to apply transliteration.
+
+camelCaseAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which to do a decomposition of camel case words.
+ default: []
+
+customNormalization:
+ type: object
+ additionalProperties: true
+ description: Override the default normalization handled by the engine.
+ default: {}
+
+decompoundedAttributes:
+ type: object
+ additionalProperties: true
+ description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
+ default: {}
+
+disablePrefixOnAttributes:
+ type: array
+ items:
+ type: string
+ description: List of attributes on which you want to disable prefix matching.
+ default: []
+
+disableTypoToleranceOnWords:
+ type: array
+ items:
+ type: string
+ description: A list of words for which you want to turn off typo tolerance.
+ default: []
+
+filterPromotes:
+ type: boolean
+ description: Whether promoted results should match the filters of the current search, except for geographic filters.
+ default: false
+
+indexLanguages:
+ type: array
+ items:
+ type: string
+ description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
+ default: []
+
+numericAttributesForFiltering:
+ type: array
+ items:
+ type: string
+ description: List of numeric attributes that can be used as numerical filters.
+ default: null
+
+paginationLimitedTo:
+ type: integer
+ description: Set the maximum number of hits accessible via pagination.
+ default: 1000
+
+replicas:
+ type: array
+ items:
+ type: string
+ description: Creates replicas, exact copies of an index.
+ default: []
+
+userData:
+ type: object
+ additionalProperties: true
+ description: Lets you store custom data in your indices.
+ default: {}
diff --git a/output/model/searchParams.ts b/output/model/searchParams.ts
index bf4ca930756..f3422011826 100644
--- a/output/model/searchParams.ts
+++ b/output/model/searchParams.ts
@@ -4,7 +4,7 @@ export class SearchParams {
/**
* The text to search in the index.
*/
- 'query'?: string;
+ 'query': string;
/**
* Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.
*/
@@ -41,10 +41,6 @@ export class SearchParams {
* Controls the relevancy threshold below which less relevant results aren’t included in the results.
*/
'relevancyStrictness'?: number;
- /**
- * Creates replicas, exact copies of an index.
- */
- 'replicas'?: Array;
/**
* Filter the query with numeric, facet and/or tag filters.
*/
@@ -125,10 +121,6 @@ export class SearchParams {
* Set the number of hits to retrieve (used only with offset).
*/
'length'?: number;
- /**
- * Set the maximum number of hits accessible via pagination.
- */
- 'paginationLimitedTo'?: number;
/**
* Minimum number of characters a word in the query string must contain to accept matches with 1 typo.
*/
@@ -149,10 +141,6 @@ export class SearchParams {
* List of attributes on which you want to disable typo tolerance.
*/
'disableTypoToleranceOnAttributes'?: Array;
- /**
- * A list of words for which you want to turn off typo tolerance.
- */
- 'disableTypoToleranceOnWords'?: Array;
/**
* Control which separators are indexed.
*/
@@ -165,10 +153,7 @@ export class SearchParams {
* Search for entries around a given location automatically computed from the requester’s IP address.
*/
'aroundLatLngViaIP'?: boolean;
- /**
- * Define the maximum radius for a geo search (in meters).
- */
- 'aroundRadius'?: string;
+ 'aroundRadius'?: number | string;
/**
* Precision of geo search (in meters), to add grouping by geo location to the ranking formula.
*/
@@ -189,38 +174,18 @@ export class SearchParams {
* Treats singular, plurals, and other forms of declensions as matching terms.
*/
'ignorePlurals'?: string;
- /**
- * Specify on which attributes to apply transliteration.
- */
- 'attributesToTransliterate'?: Array;
/**
* Removes stop (common) words from the query before executing it.
*/
'removeStopWords'?: string;
- /**
- * List of attributes on which to do a decomposition of camel case words.
- */
- 'camelCaseAttributes'?: Array;
- /**
- * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.
- */
- 'decompoundedAttributes'?: { [key: string]: object };
/**
* List of characters that the engine shouldn’t automatically normalize.
*/
'keepDiacriticsOnCharacters'?: string;
- /**
- * Override the default normalization handled by the engine.
- */
- 'customNormalization'?: { [key: string]: object };
/**
* Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
*/
'queryLanguages'?: Array;
- /**
- * Sets the languages at the index level for language-specific processing such as tokenization and normalization.
- */
- 'indexLanguages'?: Array;
/**
* This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.
*/
@@ -233,10 +198,6 @@ export class SearchParams {
* Whether Rules should be globally enabled.
*/
'enableRules'?: boolean;
- /**
- * Whether promoted results should match the filters of the current search, except for geographic filters.
- */
- 'filterPromotes'?: boolean;
/**
* Enables contextual rules.
*/
@@ -269,10 +230,6 @@ export class SearchParams {
* A list of words that should be considered as optional when found in the query.
*/
'optionalWords'?: Array;
- /**
- * List of attributes on which you want to disable prefix matching.
- */
- 'disablePrefixOnAttributes'?: Array;
/**
* List of attributes on which you want to disable the exact ranking criterion.
*/
@@ -289,18 +246,6 @@ export class SearchParams {
* Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.
*/
'advancedSyntaxFeatures'?: Array;
- /**
- * List of numeric attributes that can be used as numerical filters.
- */
- 'numericAttributesForFiltering'?: Array;
- /**
- * Enables compression of large integer arrays.
- */
- 'allowCompressionOfIntegerArray'?: boolean;
- /**
- * Name of the de-duplication attribute to be used with the distinct feature.
- */
- 'attributeForDistinct'?: string;
/**
* Enables de-duplication or grouping of results.
*/
@@ -349,10 +294,6 @@ export class SearchParams {
* When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
*/
'attributeCriteriaComputedByMinProximity'?: boolean;
- /**
- * Lets you store custom data in your indices.
- */
- 'userData'?: { [key: string]: object };
/**
* Whether this search should participate in running AB tests.
*/
@@ -419,11 +360,6 @@ export class SearchParams {
baseName: 'relevancyStrictness',
type: 'number',
},
- {
- name: 'replicas',
- baseName: 'replicas',
- type: 'Array',
- },
{
name: 'filters',
baseName: 'filters',
@@ -524,11 +460,6 @@ export class SearchParams {
baseName: 'length',
type: 'number',
},
- {
- name: 'paginationLimitedTo',
- baseName: 'paginationLimitedTo',
- type: 'number',
- },
{
name: 'minWordSizefor1Typo',
baseName: 'minWordSizefor1Typo',
@@ -554,11 +485,6 @@ export class SearchParams {
baseName: 'disableTypoToleranceOnAttributes',
type: 'Array',
},
- {
- name: 'disableTypoToleranceOnWords',
- baseName: 'disableTypoToleranceOnWords',
- type: 'Array',
- },
{
name: 'separatorsToIndex',
baseName: 'separatorsToIndex',
@@ -577,7 +503,7 @@ export class SearchParams {
{
name: 'aroundRadius',
baseName: 'aroundRadius',
- type: 'string',
+ type: 'number | string',
},
{
name: 'aroundPrecision',
@@ -604,46 +530,21 @@ export class SearchParams {
baseName: 'ignorePlurals',
type: 'string',
},
- {
- name: 'attributesToTransliterate',
- baseName: 'attributesToTransliterate',
- type: 'Array',
- },
{
name: 'removeStopWords',
baseName: 'removeStopWords',
type: 'string',
},
- {
- name: 'camelCaseAttributes',
- baseName: 'camelCaseAttributes',
- type: 'Array',
- },
- {
- name: 'decompoundedAttributes',
- baseName: 'decompoundedAttributes',
- type: '{ [key: string]: object; }',
- },
{
name: 'keepDiacriticsOnCharacters',
baseName: 'keepDiacriticsOnCharacters',
type: 'string',
},
- {
- name: 'customNormalization',
- baseName: 'customNormalization',
- type: '{ [key: string]: object; }',
- },
{
name: 'queryLanguages',
baseName: 'queryLanguages',
type: 'Array',
},
- {
- name: 'indexLanguages',
- baseName: 'indexLanguages',
- type: 'Array',
- },
{
name: 'naturalLanguages',
baseName: 'naturalLanguages',
@@ -659,11 +560,6 @@ export class SearchParams {
baseName: 'enableRules',
type: 'boolean',
},
- {
- name: 'filterPromotes',
- baseName: 'filterPromotes',
- type: 'boolean',
- },
{
name: 'ruleContexts',
baseName: 'ruleContexts',
@@ -704,11 +600,6 @@ export class SearchParams {
baseName: 'optionalWords',
type: 'Array',
},
- {
- name: 'disablePrefixOnAttributes',
- baseName: 'disablePrefixOnAttributes',
- type: 'Array',
- },
{
name: 'disableExactOnAttributes',
baseName: 'disableExactOnAttributes',
@@ -729,21 +620,6 @@ export class SearchParams {
baseName: 'advancedSyntaxFeatures',
type: 'Array',
},
- {
- name: 'numericAttributesForFiltering',
- baseName: 'numericAttributesForFiltering',
- type: 'Array',
- },
- {
- name: 'allowCompressionOfIntegerArray',
- baseName: 'allowCompressionOfIntegerArray',
- type: 'boolean',
- },
- {
- name: 'attributeForDistinct',
- baseName: 'attributeForDistinct',
- type: 'string',
- },
{
name: 'distinct',
baseName: 'distinct',
@@ -804,11 +680,6 @@ export class SearchParams {
baseName: 'attributeCriteriaComputedByMinProximity',
type: 'boolean',
},
- {
- name: 'userData',
- baseName: 'userData',
- type: '{ [key: string]: object; }',
- },
{
name: 'enableABTest',
baseName: 'enableABTest',
diff --git a/yarn.lock b/yarn.lock
index 18627fa2f1e..f634d4c2817 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -226,11 +226,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=4ffd32&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=90d1fe&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 084b17d9a63a13b0bb325ed64fc6ef18ec64212498dc9084b23ef3bd846cb9c9fbac6a10f8489e0c489ce2a68f3e54c8b69ad29980803be159f74e7ad622e5cb
+ checksum: 94c5f58ac41c79f9321705133231ba9acc0c38a16700b7cb96552a9d95d80799c3ecd7d63f270cd096613d79d0a6e9bc4140f1a93ba1e40969309e75f8445b11
languageName: node
linkType: hard
From 141db698ac11be79e2ae02b41d8476a2ca22d3c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?=
Date: Wed, 17 Nov 2021 16:19:17 +0100
Subject: [PATCH 10/11] better search response
---
.../paths/indexes/multipleQueries.yml | 16 +--
openapi_spec/paths/indexes/search.yml | 97 +--------------
openapi_spec/responses/common.yml | 11 ++
openapi_spec/schemas/Record.yml | 37 +-----
openapi_spec/schemas/SearchResponse.yml | 115 ++++++++++++++++++
openapitools.json | 1 +
output/client-search/searchApi.ts | 8 +-
output/model/highlightResult.ts | 57 +++++++++
output/model/models.ts | 26 +++-
output/model/multipleQueriesResponse.ts | 6 +-
.../model/multipleQueriesResponseResults.ts | 32 -----
output/model/rankingInfo.ts | 110 +++++++++++++++++
output/model/rankingInfoMatchedGeoLocation.ts | 40 ++++++
output/model/record.ts | 29 ++++-
...ngleQueryResponse.ts => searchResponse.ts} | 31 ++---
output/model/searchResponseFacetsStats.ts | 49 ++++++++
output/model/snippetResult.ts | 39 ++++++
yarn.lock | 8 +-
18 files changed, 509 insertions(+), 203 deletions(-)
create mode 100644 openapi_spec/schemas/SearchResponse.yml
create mode 100644 output/model/highlightResult.ts
delete mode 100644 output/model/multipleQueriesResponseResults.ts
create mode 100644 output/model/rankingInfo.ts
create mode 100644 output/model/rankingInfoMatchedGeoLocation.ts
rename output/model/{singleQueryResponse.ts => searchResponse.ts} (90%)
create mode 100644 output/model/searchResponseFacetsStats.ts
create mode 100644 output/model/snippetResult.ts
diff --git a/openapi_spec/paths/indexes/multipleQueries.yml b/openapi_spec/paths/indexes/multipleQueries.yml
index 257f42078f4..5f0749b37c7 100644
--- a/openapi_spec/paths/indexes/multipleQueries.yml
+++ b/openapi_spec/paths/indexes/multipleQueries.yml
@@ -56,18 +56,8 @@ post:
results:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- hits:
- type: array
- items:
- $ref: ../../schemas/Record.yml#/record
- nbHits:
- type: integer
- queryID:
- $ref: '../../responses/common.yml#/queryID'
+ $ref: ../../schemas/SearchResponse.yml#/searchResponse
'400':
- $ref: '../../responses/BadRequest.yml'
+ $ref: ../../responses/BadRequest.yml
'404':
- $ref: '../../responses/IndexNotFound.yml'
+ $ref: ../../responses/IndexNotFound.yml
diff --git a/openapi_spec/paths/indexes/search.yml b/openapi_spec/paths/indexes/search.yml
index 87a19dc5682..0b6d615b311 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -20,99 +20,8 @@ post:
application/json:
schema:
title: singleQueryResponse
- type: object
- additionalProperties: false
- properties:
- abTestID:
- type: integer
- description: If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
- abTestVariantID:
- type: integer
- description: If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.
- aroundLatLng:
- type: string
- description: The computed geo location.
- pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
- automaticRadius:
- type: string
- description: The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.
- exhaustiveFacetsCount:
- type: boolean
- description: Whether the facet count is exhaustive or approximate.
- exhaustiveNbHits:
- type: boolean
- description: Indicate if the nbHits count was exhaustive or approximate
- exhaustiveTypo:
- type: boolean
- description: Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)
- facets:
- type: object
- additionalProperties:
- type: object
- additionalProperties:
- type: string
- description: A mapping of each facet name to the corresponding facet counts.
- example:
- category:
- food: 1
- tech: 42
- facets_stats:
- type: object
- description: Statistics for numerical facets.
- queryID:
- $ref: ../../responses/common.yml#/queryID
- hits:
- type: array
- items:
- $ref: ../../schemas/Record.yml#/record
- hitsPerPage:
- $ref: ../../schemas/SearchParams.yml#/searchParams/properties/hitsPerPage
- index:
- type: string
- example: indexName
- indexUsed:
- type: string
- description: Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
- example: indexNameAlt
- message:
- type: string
- description: Used to return warnings about the query.
- nbHits:
- type: integer
- description: Number of hits that the search query matched
- example: 20
- nbPages:
- type: integer
- description: Number of pages available for the current query
- example: 1
- nbSortedHits:
- type: integer
- description: The number of hits selected and sorted by the relevant sort algorithm
- example: 20
- page:
- $ref: ../../schemas/SearchParams.yml#/searchParams/properties/page
- params:
- type: string
- description: A url-encoded string of all search parameters.
- example: query=a&hitsPerPage=20
- parsedQuery:
- type: string
- description: The query string that will be searched, after normalization.
- processingTimeMS:
- type: number
- description: Time the server took to process the request, in milliseconds.
- example: 20
- query:
- $ref: ../../schemas/SearchParams.yml#/searchParams/properties/query
- queryAfterRemoval:
- type: string
- description: A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
- serverUsed:
- type: string
- description: Actual host name of the server that processed the request.
- userData:
- $ref: ../../schemas/IndexSettingsParams.yml#/userData
+ $ref: ../../schemas/SearchResponse.yml#/searchResponse
'400':
- $ref: '../../responses/BadRequest.yml'
+ $ref: ../../responses/BadRequest.yml
'404':
- $ref: '../../responses/IndexNotFound.yml'
+ $ref: ../../responses/IndexNotFound.yml
diff --git a/openapi_spec/responses/common.yml b/openapi_spec/responses/common.yml
index 5f32d367655..cc9d2bf26a5 100644
--- a/openapi_spec/responses/common.yml
+++ b/openapi_spec/responses/common.yml
@@ -1,15 +1,26 @@
taskID:
type: integer
description: taskID of the indexing task to wait for.
+
objectID:
type: string
description: Unique identifier of the object
+
objectIDs:
type: array
items:
type: string
description: List of objectID
+
queryID:
type: string
pattern: '^[a-f0-9]{32}$'
example: 43b15df305339e827f0ac0bdc5ebcaa7
+
+abTestID:
+ type: integer
+ description: If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
+
+abTestVariantID:
+ type: integer
+ description: If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.
diff --git a/openapi_spec/schemas/Record.yml b/openapi_spec/schemas/Record.yml
index 9b6eb205c4c..a41bf93019b 100644
--- a/openapi_spec/schemas/Record.yml
+++ b/openapi_spec/schemas/Record.yml
@@ -1,45 +1,20 @@
-# TODO have a polymorphic record
record:
type: object
description: A single record
additionalProperties: true
- properties:
- objectID:
- $ref: '../responses/common.yml#/objectID'
-
-recordWithHighlight:
- type: object
- description: A single record with highlight attributes
- additionalProperties: true
+ required:
+ - objectID
properties:
objectID:
$ref: '../responses/common.yml#/objectID'
_highlightResult:
- type: object
- additionalProperties:
- $ref: '#/highlightResult'
-
-recordWithSnippet:
- type: object
- description: A single record with snippeted attributes
- additionalProperties: true
- properties:
- objectID:
- $ref: '../responses/common.yml#/objectID'
+ $ref: '#/highlightResult'
_snippetResult:
- type: object
- additionalProperties:
- $ref: '#/snippetResult'
-
-recordWithRanking:
- type: object
- description: A single record with ranking information
- additionalProperties: true
- properties:
- objectID:
- $ref: '../responses/common.yml#/objectID'
+ $ref: '#/snippetResult'
_rankingInfo:
$ref: '#/rankingInfo'
+ _distinctSeqID:
+ type: number
# Props
highlightResult:
diff --git a/openapi_spec/schemas/SearchResponse.yml b/openapi_spec/schemas/SearchResponse.yml
new file mode 100644
index 00000000000..4df0fb55c0d
--- /dev/null
+++ b/openapi_spec/schemas/SearchResponse.yml
@@ -0,0 +1,115 @@
+searchResponse:
+ type: object
+ additionalProperties: false
+ required:
+ - hits
+ - nbHits
+ - page
+ - nbPages
+ - hitsPerPage
+ - processingTimeMS
+ - exhaustiveNbHits
+ - exhaustiveTypo
+ - query
+ - params
+ properties:
+ abTestID:
+ $ref: ../responses/common.yml#/abTestID
+ abTestVariantID:
+ $ref: ../responses/common.yml#/abTestVariantID
+ aroundLatLng:
+ type: string
+ description: The computed geo location.
+ pattern: ^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$
+ automaticRadius:
+ type: string
+ description: The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.
+ exhaustiveFacetsCount:
+ type: boolean
+ description: Whether the facet count is exhaustive or approximate.
+ exhaustiveNbHits:
+ type: boolean
+ description: Indicate if the nbHits count was exhaustive or approximate
+ exhaustiveTypo:
+ type: boolean
+ description: Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)
+ facets:
+ type: object
+ additionalProperties:
+ type: object
+ additionalProperties:
+ type: string
+ description: A mapping of each facet name to the corresponding facet counts.
+ example:
+ category:
+ food: 1
+ tech: 42
+ facets_stats:
+ type: object
+ description: Statistics for numerical facets.
+ additionalProperties:
+ type: object
+ properties:
+ min:
+ type: integer
+ description: The minimum value in the result set.
+ max:
+ type: integer
+ description: The maximum value in the result set.
+ avg:
+ type: integer
+ description: The average facet value in the result set.
+ sum:
+ type: integer
+ description: The sum of all values in the result set.
+ hits:
+ type: array
+ items:
+ $ref: Record.yml#/record
+ hitsPerPage:
+ $ref: SearchParams.yml#/searchParams/properties/hitsPerPage
+ index:
+ type: string
+ example: indexName
+ indexUsed:
+ type: string
+ description: Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
+ example: indexNameAlt
+ message:
+ type: string
+ description: Used to return warnings about the query.
+ nbHits:
+ type: integer
+ description: Number of hits that the search query matched
+ example: 20
+ nbPages:
+ type: integer
+ description: Number of pages available for the current query
+ example: 1
+ nbSortedHits:
+ type: integer
+ description: The number of hits selected and sorted by the relevant sort algorithm
+ example: 20
+ page:
+ $ref: SearchParams.yml#/searchParams/properties/page
+ params:
+ type: string
+ description: A url-encoded string of all search parameters.
+ example: query=a&hitsPerPage=20
+ parsedQuery:
+ type: string
+ description: The query string that will be searched, after normalization.
+ processingTimeMS:
+ type: number
+ description: Time the server took to process the request, in milliseconds.
+ example: 20
+ query:
+ $ref: SearchParams.yml#/searchParams/properties/query
+ queryAfterRemoval:
+ type: string
+ description: A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
+ serverUsed:
+ type: string
+ description: Actual host name of the server that processed the request.
+ userData:
+ $ref: IndexSettingsParams.yml#/userData
diff --git a/openapitools.json b/openapitools.json
index 8393278723c..145555b10b3 100644
--- a/openapitools.json
+++ b/openapitools.json
@@ -15,6 +15,7 @@
"gitUserId": "algolia",
"gitRepoId": "algoliasearch-client-javascript",
"additionalProperties": {
+ "modelPropertyNaming": "original",
"supportsES6": true,
"npmName": "algoliasearch-client-javascript",
"npmVersion": "5.0.0"
diff --git a/output/client-search/searchApi.ts b/output/client-search/searchApi.ts
index 269cb5ff003..693533a276b 100644
--- a/output/client-search/searchApi.ts
+++ b/output/client-search/searchApi.ts
@@ -8,7 +8,7 @@ import { MultipleQueriesResponse } from '../model/multipleQueriesResponse';
import { SaveObjectResponse } from '../model/saveObjectResponse';
import { SearchParams } from '../model/searchParams';
import { SearchParamsString } from '../model/searchParamsString';
-import { SingleQueryResponse } from '../model/singleQueryResponse';
+import { SearchResponse } from '../model/searchResponse';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
@@ -379,7 +379,7 @@ export class SearchApi {
indexName: string,
searchParamsSearchParamsString: SearchParams | SearchParamsString,
options: { headers: { [name: string]: string } } = { headers: {} }
- ): Promise<{ response: http.IncomingMessage; body: SingleQueryResponse }> {
+ ): Promise<{ response: http.IncomingMessage; body: SearchResponse }> {
const localVarPath =
this.basePath +
'/1/indexes/{indexName}/query'.replace(
@@ -454,13 +454,13 @@ export class SearchApi {
localVarRequestOptions.form = localVarFormParams;
}
}
- return new Promise<{ response: http.IncomingMessage; body: SingleQueryResponse }>(
+ return new Promise<{ response: http.IncomingMessage; body: SearchResponse }>(
(resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
- body = ObjectSerializer.deserialize(body, 'SingleQueryResponse');
+ body = ObjectSerializer.deserialize(body, 'SearchResponse');
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
diff --git a/output/model/highlightResult.ts b/output/model/highlightResult.ts
new file mode 100644
index 00000000000..de5d38781a0
--- /dev/null
+++ b/output/model/highlightResult.ts
@@ -0,0 +1,57 @@
+import { RequestFile } from './models';
+
+export class HighlightResult {
+ /**
+ * Markup text with occurrences highlighted.
+ */
+ 'value'?: string;
+ /**
+ * Indicates how well the attribute matched the search query.
+ */
+ 'matchLevel'?: HighlightResult.MatchLevelEnum;
+ /**
+ * List of words from the query that matched the object.
+ */
+ 'matchedWords'?: Array;
+ /**
+ * Whether the entire attribute value is highlighted.
+ */
+ 'fullyHighlighted'?: boolean;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'value',
+ baseName: 'value',
+ type: 'string',
+ },
+ {
+ name: 'matchLevel',
+ baseName: 'matchLevel',
+ type: 'HighlightResult.MatchLevelEnum',
+ },
+ {
+ name: 'matchedWords',
+ baseName: 'matchedWords',
+ type: 'Array',
+ },
+ {
+ name: 'fullyHighlighted',
+ baseName: 'fullyHighlighted',
+ type: 'boolean',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return HighlightResult.attributeTypeMap;
+ }
+}
+
+export namespace HighlightResult {
+ export enum MatchLevelEnum {
+ None = 'none',
+ Partial = 'partial',
+ Full = 'full',
+ }
+}
diff --git a/output/model/models.ts b/output/model/models.ts
index 58bf74dbf82..7568076dc44 100644
--- a/output/model/models.ts
+++ b/output/model/models.ts
@@ -2,17 +2,21 @@ import localVarRequest from 'request';
export * from './batchObject';
export * from './batchResponse';
+export * from './highlightResult';
export * from './modelError';
export * from './multipleQueries';
export * from './multipleQueriesObject';
export * from './multipleQueriesResponse';
-export * from './multipleQueriesResponseResults';
export * from './operation';
+export * from './rankingInfo';
+export * from './rankingInfoMatchedGeoLocation';
export * from './record';
export * from './saveObjectResponse';
export * from './searchParams';
export * from './searchParamsString';
-export * from './singleQueryResponse';
+export * from './searchResponse';
+export * from './searchResponseFacetsStats';
+export * from './snippetResult';
import * as fs from 'fs';
@@ -28,21 +32,26 @@ export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile;
import { BatchObject } from './batchObject';
import { BatchResponse } from './batchResponse';
+import { HighlightResult } from './highlightResult';
import { ModelError } from './modelError';
import { MultipleQueries } from './multipleQueries';
import { MultipleQueriesObject } from './multipleQueriesObject';
import { MultipleQueriesResponse } from './multipleQueriesResponse';
-import { MultipleQueriesResponseResults } from './multipleQueriesResponseResults';
import { Operation } from './operation';
+import { RankingInfo } from './rankingInfo';
+import { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation';
import { Record } from './record';
import { SaveObjectResponse } from './saveObjectResponse';
import { SearchParams } from './searchParams';
import { SearchParamsString } from './searchParamsString';
-import { SingleQueryResponse } from './singleQueryResponse';
+import { SearchResponse } from './searchResponse';
+import { SearchResponseFacetsStats } from './searchResponseFacetsStats';
+import { SnippetResult } from './snippetResult';
let primitives = ['string', 'boolean', 'double', 'integer', 'long', 'float', 'number', 'any'];
let enumsMap: { [index: string]: any } = {
+ 'HighlightResult.MatchLevelEnum': HighlightResult.MatchLevelEnum,
'MultipleQueries.TypeEnum': MultipleQueries.TypeEnum,
'MultipleQueriesObject.StrategyEnum': MultipleQueriesObject.StrategyEnum,
'Operation.ActionEnum': Operation.ActionEnum,
@@ -52,22 +61,27 @@ let enumsMap: { [index: string]: any } = {
'SearchParams.ExactOnSingleWordQueryEnum': SearchParams.ExactOnSingleWordQueryEnum,
'SearchParams.AlternativesAsExactEnum': SearchParams.AlternativesAsExactEnum,
'SearchParams.AdvancedSyntaxFeaturesEnum': SearchParams.AdvancedSyntaxFeaturesEnum,
+ 'SnippetResult.MatchLevelEnum': SnippetResult.MatchLevelEnum,
};
let typeMap: { [index: string]: any } = {
BatchObject: BatchObject,
BatchResponse: BatchResponse,
+ HighlightResult: HighlightResult,
ModelError: ModelError,
MultipleQueries: MultipleQueries,
MultipleQueriesObject: MultipleQueriesObject,
MultipleQueriesResponse: MultipleQueriesResponse,
- MultipleQueriesResponseResults: MultipleQueriesResponseResults,
Operation: Operation,
+ RankingInfo: RankingInfo,
+ RankingInfoMatchedGeoLocation: RankingInfoMatchedGeoLocation,
Record: Record,
SaveObjectResponse: SaveObjectResponse,
SearchParams: SearchParams,
SearchParamsString: SearchParamsString,
- SingleQueryResponse: SingleQueryResponse,
+ SearchResponse: SearchResponse,
+ SearchResponseFacetsStats: SearchResponseFacetsStats,
+ SnippetResult: SnippetResult,
};
export class ObjectSerializer {
diff --git a/output/model/multipleQueriesResponse.ts b/output/model/multipleQueriesResponse.ts
index 99b22e12c5b..dcf1fdf7d1e 100644
--- a/output/model/multipleQueriesResponse.ts
+++ b/output/model/multipleQueriesResponse.ts
@@ -1,8 +1,8 @@
import { RequestFile } from './models';
-import { MultipleQueriesResponseResults } from './multipleQueriesResponseResults';
+import { SearchResponse } from './searchResponse';
export class MultipleQueriesResponse {
- 'results'?: Array;
+ 'results'?: Array;
static discriminator: string | undefined = undefined;
@@ -10,7 +10,7 @@ export class MultipleQueriesResponse {
{
name: 'results',
baseName: 'results',
- type: 'Array',
+ type: 'Array',
},
];
diff --git a/output/model/multipleQueriesResponseResults.ts b/output/model/multipleQueriesResponseResults.ts
deleted file mode 100644
index dce9fe2a8b3..00000000000
--- a/output/model/multipleQueriesResponseResults.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { RequestFile } from './models';
-import { Record } from './record';
-
-export class MultipleQueriesResponseResults {
- 'hits'?: Array;
- 'nbHits'?: number;
- 'queryID'?: string;
-
- static discriminator: string | undefined = undefined;
-
- static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
- {
- name: 'hits',
- baseName: 'hits',
- type: 'Array',
- },
- {
- name: 'nbHits',
- baseName: 'nbHits',
- type: 'number',
- },
- {
- name: 'queryID',
- baseName: 'queryID',
- type: 'string',
- },
- ];
-
- static getAttributeTypeMap() {
- return MultipleQueriesResponseResults.attributeTypeMap;
- }
-}
diff --git a/output/model/rankingInfo.ts b/output/model/rankingInfo.ts
new file mode 100644
index 00000000000..60f0aac8be6
--- /dev/null
+++ b/output/model/rankingInfo.ts
@@ -0,0 +1,110 @@
+import { RequestFile } from './models';
+import { RankingInfoMatchedGeoLocation } from './rankingInfoMatchedGeoLocation';
+
+export class RankingInfo {
+ /**
+ * This field is reserved for advanced usage.
+ */
+ 'filters'?: number;
+ /**
+ * Position of the most important matched attribute in the attributes to index list.
+ */
+ 'firstMatchedWord'?: number;
+ /**
+ * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).
+ */
+ 'geoDistance'?: number;
+ /**
+ * Precision used when computing the geo distance, in meters.
+ */
+ 'geoPrecision'?: number;
+ 'matchedGeoLocation'?: { [key: string]: RankingInfoMatchedGeoLocation };
+ /**
+ * Number of exactly matched words.
+ */
+ 'nbExactWords'?: number;
+ /**
+ * Number of typos encountered when matching the record.
+ */
+ 'nbTypos'?: number;
+ /**
+ * Present and set to true if a Rule promoted the hit.
+ */
+ 'promoted'?: boolean;
+ /**
+ * When the query contains more than one word, the sum of the distances between matched words (in meters).
+ */
+ 'proximityDistance'?: number;
+ /**
+ * Custom ranking for the object, expressed as a single integer value.
+ */
+ 'userScore'?: number;
+ /**
+ * Number of matched words, including prefixes and typos.
+ */
+ 'word'?: number;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'filters',
+ baseName: 'filters',
+ type: 'number',
+ },
+ {
+ name: 'firstMatchedWord',
+ baseName: 'firstMatchedWord',
+ type: 'number',
+ },
+ {
+ name: 'geoDistance',
+ baseName: 'geoDistance',
+ type: 'number',
+ },
+ {
+ name: 'geoPrecision',
+ baseName: 'geoPrecision',
+ type: 'number',
+ },
+ {
+ name: 'matchedGeoLocation',
+ baseName: 'matchedGeoLocation',
+ type: '{ [key: string]: RankingInfoMatchedGeoLocation; }',
+ },
+ {
+ name: 'nbExactWords',
+ baseName: 'nbExactWords',
+ type: 'number',
+ },
+ {
+ name: 'nbTypos',
+ baseName: 'nbTypos',
+ type: 'number',
+ },
+ {
+ name: 'promoted',
+ baseName: 'promoted',
+ type: 'boolean',
+ },
+ {
+ name: 'proximityDistance',
+ baseName: 'proximityDistance',
+ type: 'number',
+ },
+ {
+ name: 'userScore',
+ baseName: 'userScore',
+ type: 'number',
+ },
+ {
+ name: 'word',
+ baseName: 'word',
+ type: 'number',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return RankingInfo.attributeTypeMap;
+ }
+}
diff --git a/output/model/rankingInfoMatchedGeoLocation.ts b/output/model/rankingInfoMatchedGeoLocation.ts
new file mode 100644
index 00000000000..91b552ad448
--- /dev/null
+++ b/output/model/rankingInfoMatchedGeoLocation.ts
@@ -0,0 +1,40 @@
+import { RequestFile } from './models';
+
+export class RankingInfoMatchedGeoLocation {
+ /**
+ * Latitude of the matched location.
+ */
+ 'lat'?: number;
+ /**
+ * Longitude of the matched location.
+ */
+ 'lng'?: number;
+ /**
+ * Distance between the matched location and the search location (in meters).
+ */
+ 'distance'?: number;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'lat',
+ baseName: 'lat',
+ type: 'number',
+ },
+ {
+ name: 'lng',
+ baseName: 'lng',
+ type: 'number',
+ },
+ {
+ name: 'distance',
+ baseName: 'distance',
+ type: 'number',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return RankingInfoMatchedGeoLocation.attributeTypeMap;
+ }
+}
diff --git a/output/model/record.ts b/output/model/record.ts
index f0d5f43029f..7400eda9919 100644
--- a/output/model/record.ts
+++ b/output/model/record.ts
@@ -1,4 +1,7 @@
import { RequestFile } from './models';
+import { HighlightResult } from './highlightResult';
+import { RankingInfo } from './rankingInfo';
+import { SnippetResult } from './snippetResult';
/**
* A single record
@@ -7,7 +10,11 @@ export class Record extends null {
/**
* Unique identifier of the object
*/
- 'objectID'?: string;
+ 'objectID': string;
+ '_highlightResult'?: HighlightResult;
+ '_snippetResult'?: SnippetResult;
+ '_rankingInfo'?: RankingInfo;
+ '_distinctSeqID'?: number;
static discriminator: string | undefined = undefined;
@@ -17,6 +24,26 @@ export class Record extends null {
baseName: 'objectID',
type: 'string',
},
+ {
+ name: '_highlightResult',
+ baseName: '_highlightResult',
+ type: 'HighlightResult',
+ },
+ {
+ name: '_snippetResult',
+ baseName: '_snippetResult',
+ type: 'SnippetResult',
+ },
+ {
+ name: '_rankingInfo',
+ baseName: '_rankingInfo',
+ type: 'RankingInfo',
+ },
+ {
+ name: '_distinctSeqID',
+ baseName: '_distinctSeqID',
+ type: 'number',
+ },
];
static getAttributeTypeMap() {
diff --git a/output/model/singleQueryResponse.ts b/output/model/searchResponse.ts
similarity index 90%
rename from output/model/singleQueryResponse.ts
rename to output/model/searchResponse.ts
index 873bb735892..0b00cdc2481 100644
--- a/output/model/singleQueryResponse.ts
+++ b/output/model/searchResponse.ts
@@ -1,7 +1,8 @@
import { RequestFile } from './models';
import { Record } from './record';
+import { SearchResponseFacetsStats } from './searchResponseFacetsStats';
-export class SingleQueryResponse {
+export class SearchResponse {
/**
* If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.
*/
@@ -25,11 +26,11 @@ export class SingleQueryResponse {
/**
* Indicate if the nbHits count was exhaustive or approximate
*/
- 'exhaustiveNbHits'?: boolean;
+ 'exhaustiveNbHits': boolean;
/**
* Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)
*/
- 'exhaustiveTypo'?: boolean;
+ 'exhaustiveTypo': boolean;
/**
* A mapping of each facet name to the corresponding facet counts.
*/
@@ -37,12 +38,12 @@ export class SingleQueryResponse {
/**
* Statistics for numerical facets.
*/
- 'facetsStats'?: object;
- 'hits'?: Array;
+ 'facets_stats'?: { [key: string]: SearchResponseFacetsStats };
+ 'hits': Array;
/**
* Set the number of hits per page.
*/
- 'hitsPerPage'?: number;
+ 'hitsPerPage': number;
'index'?: string;
/**
* Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
@@ -55,11 +56,11 @@ export class SingleQueryResponse {
/**
* Number of hits that the search query matched
*/
- 'nbHits'?: number;
+ 'nbHits': number;
/**
* Number of pages available for the current query
*/
- 'nbPages'?: number;
+ 'nbPages': number;
/**
* The number of hits selected and sorted by the relevant sort algorithm
*/
@@ -67,11 +68,11 @@ export class SingleQueryResponse {
/**
* Specify the page to retrieve.
*/
- 'page'?: number;
+ 'page': number;
/**
* A url-encoded string of all search parameters.
*/
- 'params'?: string;
+ 'params': string;
/**
* The query string that will be searched, after normalization.
*/
@@ -79,11 +80,11 @@ export class SingleQueryResponse {
/**
* Time the server took to process the request, in milliseconds.
*/
- 'processingTimeMS'?: number;
+ 'processingTimeMS': number;
/**
* The text to search in the index.
*/
- 'query'?: string;
+ 'query': string;
/**
* A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.
*/
@@ -141,9 +142,9 @@ export class SingleQueryResponse {
type: '{ [key: string]: { [key: string]: string; }; }',
},
{
- name: 'facetsStats',
+ name: 'facets_stats',
baseName: 'facets_stats',
- type: 'object',
+ type: '{ [key: string]: SearchResponseFacetsStats; }',
},
{
name: 'hits',
@@ -228,6 +229,6 @@ export class SingleQueryResponse {
];
static getAttributeTypeMap() {
- return SingleQueryResponse.attributeTypeMap;
+ return SearchResponse.attributeTypeMap;
}
}
diff --git a/output/model/searchResponseFacetsStats.ts b/output/model/searchResponseFacetsStats.ts
new file mode 100644
index 00000000000..a9299069560
--- /dev/null
+++ b/output/model/searchResponseFacetsStats.ts
@@ -0,0 +1,49 @@
+import { RequestFile } from './models';
+
+export class SearchResponseFacetsStats {
+ /**
+ * The minimum value in the result set.
+ */
+ 'min'?: number;
+ /**
+ * The maximum value in the result set.
+ */
+ 'max'?: number;
+ /**
+ * The average facet value in the result set.
+ */
+ 'avg'?: number;
+ /**
+ * The sum of all values in the result set.
+ */
+ 'sum'?: number;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'min',
+ baseName: 'min',
+ type: 'number',
+ },
+ {
+ name: 'max',
+ baseName: 'max',
+ type: 'number',
+ },
+ {
+ name: 'avg',
+ baseName: 'avg',
+ type: 'number',
+ },
+ {
+ name: 'sum',
+ baseName: 'sum',
+ type: 'number',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SearchResponseFacetsStats.attributeTypeMap;
+ }
+}
diff --git a/output/model/snippetResult.ts b/output/model/snippetResult.ts
new file mode 100644
index 00000000000..bb590bd75e0
--- /dev/null
+++ b/output/model/snippetResult.ts
@@ -0,0 +1,39 @@
+import { RequestFile } from './models';
+
+export class SnippetResult {
+ /**
+ * Markup text with occurrences highlighted.
+ */
+ 'value'?: string;
+ /**
+ * Indicates how well the attribute matched the search query.
+ */
+ 'matchLevel'?: SnippetResult.MatchLevelEnum;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'value',
+ baseName: 'value',
+ type: 'string',
+ },
+ {
+ name: 'matchLevel',
+ baseName: 'matchLevel',
+ type: 'SnippetResult.MatchLevelEnum',
+ },
+ ];
+
+ static getAttributeTypeMap() {
+ return SnippetResult.attributeTypeMap;
+ }
+}
+
+export namespace SnippetResult {
+ export enum MatchLevelEnum {
+ None = 'none',
+ Partial = 'partial',
+ Full = 'full',
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index 7a4afbd630b..2c8d4cb1abb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -11,7 +11,7 @@ __metadata:
dependencies:
"@openapitools/openapi-generator-cli": ^2.4.13
algoliasearch-client-javascript: "file:output/"
- dotenv: ^10.0.0
+ dotenv: 10.0.0
prettier: 2.4.1
swagger-cli: ^4.0.4
typescript: 4.4.4
@@ -227,11 +227,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=41c0c3&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=d549f1&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 96e4076b74d5aebf5da0fffa1de20291ae8d9a235715b9e41bf2183e011f078cdfb5291b2b86e5b73961fbd4c6d7c7212fd1415f6182eed38074baa159012825
+ checksum: 411f40d4f943727b15d7a7bf51f8c6f1780eab1341d1479e1f5d69b7518ca03694a95e13b44fd05104b0f0746c3d6f24fda3f6dea3a61cf6d7237e59083e0778
languageName: node
linkType: hard
@@ -610,7 +610,7 @@ __metadata:
languageName: node
linkType: hard
-"dotenv@npm:^10.0.0":
+"dotenv@npm:10.0.0":
version: 10.0.0
resolution: "dotenv@npm:10.0.0"
checksum: f412c5fe8c24fbe313d302d2500e247ba8a1946492db405a4de4d30dd0eb186a88a43f13c958c5a7de303938949c4231c56994f97d05c4bc1f22478d631b4005
From 649c07c78e95d0ef340c03b467fd99eea7dcdf85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?=
Date: Wed, 17 Nov 2021 17:24:40 +0100
Subject: [PATCH 11/11] add `index` description
---
openapi_spec/schemas/SearchResponse.yml | 1 +
output/model/searchResponse.ts | 3 +++
yarn.lock | 4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/openapi_spec/schemas/SearchResponse.yml b/openapi_spec/schemas/SearchResponse.yml
index 4df0fb55c0d..472f12b169a 100644
--- a/openapi_spec/schemas/SearchResponse.yml
+++ b/openapi_spec/schemas/SearchResponse.yml
@@ -71,6 +71,7 @@ searchResponse:
index:
type: string
example: indexName
+ description: Index name used for the query.
indexUsed:
type: string
description: Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
diff --git a/output/model/searchResponse.ts b/output/model/searchResponse.ts
index 0b00cdc2481..8d36b775a8c 100644
--- a/output/model/searchResponse.ts
+++ b/output/model/searchResponse.ts
@@ -44,6 +44,9 @@ export class SearchResponse {
* Set the number of hits per page.
*/
'hitsPerPage': number;
+ /**
+ * Index name used for the query.
+ */
'index'?: string;
/**
* Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.
diff --git a/yarn.lock b/yarn.lock
index 2c8d4cb1abb..818d4f09e85 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -227,11 +227,11 @@ __metadata:
"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
- resolution: "algoliasearch-client-javascript@file:output/#output/::hash=d549f1&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=58b658&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
dependencies:
"@types/request": ^2.48.7
request: ^2.81.0
- checksum: 411f40d4f943727b15d7a7bf51f8c6f1780eab1341d1479e1f5d69b7518ca03694a95e13b44fd05104b0f0746c3d6f24fda3f6dea3a61cf6d7237e59083e0778
+ checksum: e1168a0c4f7b2eddbf14b80d553042049001da05babef16bc5008008f1ec15759ccd2b9ec231c5e9a86f21f61a9b7988c1064478cbba31468d01253c18be46a5
languageName: node
linkType: hard