diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000000..c906f42033f
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,3 @@
+ALGOLIA_APPLICATION_ID=""
+ALGOLIA_ADMIN_KEY=""
+ALGOLIA_SEARCH_KEY=""
diff --git a/app.ts b/app.ts
index 767d42543fe..6d7edcde5e1 100644
--- a/app.ts
+++ b/app.ts
@@ -1,12 +1,15 @@
-import { searchClient } from 'algoliasearch-client-javascript';
+import { searchClient, HttpError } from 'algoliasearch-client-javascript';
+import dotenv from 'dotenv';
+
+dotenv.config();
+
+const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****';
+const apiKey = process.env.ALGOLIA_SEARCH_KEY || '**** SEARCH_API_KEY *****';
-const appId = process.env.ALGOLIA_APPLICATION_ID_1 || '**** APP_ID *****';
-const apiKey = process.env.ALGOLIA_ADMIN_KEY_1 || '**** API_KEY *****';
// Init client with appId and apiKey
const client = new searchClient(appId, apiKey);
-async function testClient() {
- // test openapi gen
+async function testMultiQueries() {
try {
const res = await client.multipleQueries({
requests: [
@@ -17,10 +20,31 @@ async function testClient() {
],
});
- console.log('[1-RESPONSE]', res);
+ console.log(`[OK]`, res);
} catch (e) {
- console.error('[1-ERROR]', e);
+ if (e instanceof HttpError) {
+ return console.log(`[${e.statusCode} - ${e.response.statusMessage}]`, e.response);
+ }
+
+ console.log('[ERROR]', e);
+ }
+}
+
+async function testSearch() {
+ try {
+ const res = await client.search('docsearch', {
+ query: 'crawler',
+ });
+
+ console.log(`[OK]`, res);
+ } catch (e) {
+ if (e instanceof HttpError) {
+ return console.log(`[${e.statusCode} - ${e.response.statusMessage}]`, e.response);
+ }
+
+ console.log('[ERROR]', e);
}
}
-testClient();
+// testMultiQueries();
+testSearch();
diff --git a/openapi_spec/paths/indexes/batch.yml b/openapi_spec/paths/indexes/batch.yml
index 5a06b1aab74..7cc4ca405b6 100644
--- a/openapi_spec/paths/indexes/batch.yml
+++ b/openapi_spec/paths/indexes/batch.yml
@@ -12,6 +12,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 1b64bfb047c..5f0749b37c7 100644
--- a/openapi_spec/paths/indexes/multipleQueries.yml
+++ b/openapi_spec/paths/indexes/multipleQueries.yml
@@ -24,8 +24,7 @@ post:
example: products
description: The Algolia index name
query:
- type: string
- description: The query to search for
+ $ref: ../../schemas/SearchParams.yml#/searchParams/properties/query
type:
type: string
enum: [default, facet]
@@ -57,22 +56,8 @@ post:
results:
type: array
items:
- type: object
- additionalProperties: false
- properties:
- hits:
- type: array
- items:
- type: object
- additionalProperties: false
- properties:
- objectID:
- $ref: '../../responses/common.yml#/objectID'
- 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 a8b7b0d5d3c..0b6d615b311 100644
--- a/openapi_spec/paths/indexes/search.yml
+++ b/openapi_spec/paths/indexes/search.yml
@@ -6,7 +6,13 @@ post:
parameters:
- $ref: '../../parameters.yml#/IndexName'
requestBody:
- $ref: '../../schemas/SearchParams.yml'
+ required: true
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - $ref: ../../schemas/SearchParams.yml#/searchParams
+ - $ref: ../../schemas/SearchParams.yml#/searchParamsString
responses:
'200':
description: OK
@@ -14,24 +20,8 @@ post:
application/json:
schema:
title: singleQueryResponse
- type: object
- additionalProperties: false
- properties:
- hits:
- type: array
- items:
- type: object
- additionalProperties: false
- properties:
- objectID:
- $ref: '../../responses/common.yml#/objectID'
- nbHits:
- type: integer
- queryID:
- type: string
- pattern: '^[a-f0-9]{32}$'
- example: 43b15df305339e827f0ac0bdc5ebcaa7
+ $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/IndexSettingsParams.yml b/openapi_spec/schemas/IndexSettingsParams.yml
new file mode 100644
index 00000000000..9f608a844e7
--- /dev/null
+++ b/openapi_spec/schemas/IndexSettingsParams.yml
@@ -0,0 +1,85 @@
+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
+
+userData:
+ type: object
+ additionalProperties: true
+ description: Lets you store custom data in your indices.
+ default: {}
+
+replicas:
+ type: array
+ items:
+ type: string
+ description: Creates replicas, exact copies of an index.
+ default: []
diff --git a/openapi_spec/schemas/Record.yml b/openapi_spec/schemas/Record.yml
new file mode 100644
index 00000000000..a41bf93019b
--- /dev/null
+++ b/openapi_spec/schemas/Record.yml
@@ -0,0 +1,102 @@
+record:
+ type: object
+ description: A single record
+ additionalProperties: true
+ required:
+ - objectID
+ properties:
+ objectID:
+ $ref: '../responses/common.yml#/objectID'
+ _highlightResult:
+ $ref: '#/highlightResult'
+ _snippetResult:
+ $ref: '#/snippetResult'
+ _rankingInfo:
+ $ref: '#/rankingInfo'
+ _distinctSeqID:
+ type: number
+
+# Props
+highlightResult:
+ 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]
+ 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.'
+
+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.'
diff --git a/openapi_spec/schemas/RequestOptions.yml b/openapi_spec/schemas/RequestOptions.yml
new file mode 100644
index 00000000000..69762ce3bfc
--- /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/schemas/SearchParams.yml b/openapi_spec/schemas/SearchParams.yml
index 4dfa2cd3450..12dea2e006b 100644
--- a/openapi_spec/schemas/SearchParams.yml
+++ b/openapi_spec/schemas/SearchParams.yml
@@ -1,451 +1,393 @@
-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
+ required:
+ - query
+ 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
+ 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.
+ length:
+ type: integer
+ description: Set the number of hits to retrieve (used only with offset).
+ 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.
+ 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: []
+ 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: ''
+ aroundLatLngViaIP:
+ type: boolean
+ description: Search for entries around a given location automatically computed from the requester’s IP address.
+ default: false
+ aroundRadius:
+ 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.
+ default: 10
+ minimumAroundRadius:
+ type: integer
+ description: Minimum radius (in meters) used for a geo search when aroundRadius is not set.
+ minimum: 1
+ 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 on numeric attributes.
- default: []
- tagFilters:
- type: array
- items:
+ description: Treats singular, plurals, and other forms of declensions as matching terms.
+ default: false
+ removeStopWords:
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: Removes stop (common) words from the query before executing it.
+ default: false
+ keepDiacriticsOnCharacters:
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: List of characters that the engine shouldn’t automatically normalize.
+ 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: []
+ 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
+ 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 highlight.
- attributesToSnippet:
- type: array
- items:
+ description: Associates a certain user token with the current search.
+ queryType:
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:
+ enum: ['prefixLast', 'prefixAll', 'prefixNone']
+ description: Controls if and how query words are interpreted as prefixes.
+ default: 'prefixLast'
+ removeWordsIfNoResults:
type: string
- description: List of attributes on which you want to disable typo tolerance.
- default: []
- disableTypoToleranceOnWords:
- 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: []
+ 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: 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: ['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']
+ 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.
+ default: []
+ 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
+ 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: 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:
- 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/openapi_spec/schemas/SearchResponse.yml b/openapi_spec/schemas/SearchResponse.yml
new file mode 100644
index 00000000000..472f12b169a
--- /dev/null
+++ b/openapi_spec/schemas/SearchResponse.yml
@@ -0,0 +1,116 @@
+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
+ 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.
+ 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/openapi_spec/spec.yml b/openapi_spec/spec.yml
index 0d41865dfeb..5d669fc9581 100644
--- a/openapi_spec/spec.yml
+++ b/openapi_spec/spec.yml
@@ -34,9 +34,8 @@ security:
- appId: []
apiKey: []
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}:
diff --git a/openapitools.json b/openapitools.json
index 0ef361cae3a..96de49bae43 100644
--- a/openapitools.json
+++ b/openapitools.json
@@ -15,7 +15,8 @@
"gitUserId": "algolia",
"gitRepoId": "algoliasearch-client-javascript",
"additionalProperties": {
- "supportsES6": "true",
+ "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 b8c0118d678..8c6fb82fff5 100644
--- a/output/client-search/searchApi.ts
+++ b/output/client-search/searchApi.ts
@@ -8,6 +8,9 @@ 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 { SearchParamsString } from '../model/searchParamsString';
+import { SearchResponse } from '../model/searchResponse';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
import { HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
@@ -283,6 +286,84 @@ export class SearchApi {
await interceptorPromise;
+ return this.transporter.retryableRequest(request, requestOptions);
+ }
+ /**
+ *
+ * @summary Get search results
+ * @param indexName The index in which to perform the request
+ * @param searchParamsSearchParamsString
+ */
+ public async search(
+ indexName: string,
+ searchParamsSearchParamsString: SearchParams | SearchParamsString,
+ options: { headers: { [name: string]: string } } = { headers: {} }
+ ): Promise {
+ const path = '/1/indexes/{indexName}/query'.replace(
+ '{' + 'indexName' + '}',
+ encodeURIComponent(String(indexName))
+ );
+ let headers: Headers = {};
+ let queryParameters: Record = {};
+ const produces = ['application/json'];
+ // give precedence to 'application/json'
+ if (produces.indexOf('application/json') >= 0) {
+ headers.Accept = 'application/json';
+ } else {
+ headers.Accept = produces.join(',');
+ }
+ let formParams: Record = {};
+
+ // 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 'searchParamsSearchParamsString' is not null or undefined
+ if (searchParamsSearchParamsString === null || searchParamsSearchParamsString === undefined) {
+ throw new Error(
+ 'Required parameter searchParamsSearchParamsString was null or undefined when calling search.'
+ );
+ }
+
+ headers = { ...headers, ...options.headers };
+
+ const request: Request = {
+ method: 'POST',
+ path,
+ data: ObjectSerializer.serialize(
+ searchParamsSearchParamsString,
+ 'SearchParams | SearchParamsString'
+ ),
+ };
+
+ const requestOptions: RequestOptions = {
+ headers,
+ queryParameters,
+ };
+
+ let authenticationPromise = Promise.resolve();
+ if (this.authentications.apiKey.apiKey) {
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.apiKey.applyToRequest(requestOptions)
+ );
+ }
+ if (this.authentications.appId.apiKey) {
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.appId.applyToRequest(requestOptions)
+ );
+ }
+ authenticationPromise = authenticationPromise.then(() =>
+ this.authentications.default.applyToRequest(requestOptions)
+ );
+
+ let interceptorPromise = authenticationPromise;
+ for (const interceptor of this.interceptors) {
+ interceptorPromise = interceptorPromise.then(() => interceptor(requestOptions));
+ }
+
+ await interceptorPromise;
+
return this.transporter.retryableRequest(request, requestOptions);
}
}
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 9e42ad88448..5ab824e4e96 100644
--- a/output/model/models.ts
+++ b/output/model/models.ts
@@ -2,14 +2,21 @@ import type { RequestOptions } from '../complement/types';
export * from './batchObject';
export * from './batchResponse';
+export * from './highlightResult';
export * from './modelError';
export * from './multipleQueries';
export * from './multipleQueriesObject';
export * from './multipleQueriesResponse';
-export * from './multipleQueriesResponseHits';
-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 './searchResponse';
+export * from './searchResponseFacetsStats';
+export * from './snippetResult';
import * as fs from 'fs';
@@ -25,34 +32,56 @@ 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 { MultipleQueriesResponseHits } from './multipleQueriesResponseHits';
-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 { 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,
+ 'SearchParams.TypoToleranceEnum': SearchParams.TypoToleranceEnum,
+ 'SearchParams.QueryTypeEnum': SearchParams.QueryTypeEnum,
+ 'SearchParams.RemoveWordsIfNoResultsEnum': SearchParams.RemoveWordsIfNoResultsEnum,
+ '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,
- MultipleQueriesResponseHits: MultipleQueriesResponseHits,
- MultipleQueriesResponseResults: MultipleQueriesResponseResults,
Operation: Operation,
+ RankingInfo: RankingInfo,
+ RankingInfoMatchedGeoLocation: RankingInfoMatchedGeoLocation,
+ Record: Record,
SaveObjectResponse: SaveObjectResponse,
+ SearchParams: SearchParams,
+ SearchParamsString: SearchParamsString,
+ SearchResponse: SearchResponse,
+ SearchResponseFacetsStats: SearchResponseFacetsStats,
+ SnippetResult: SnippetResult,
};
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/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 b15174ff452..00000000000
--- a/output/model/multipleQueriesResponseResults.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { RequestFile } from './models';
-import { MultipleQueriesResponseHits } from './multipleQueriesResponseHits';
-
-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
new file mode 100644
index 00000000000..7400eda9919
--- /dev/null
+++ b/output/model/record.ts
@@ -0,0 +1,52 @@
+import { RequestFile } from './models';
+import { HighlightResult } from './highlightResult';
+import { RankingInfo } from './rankingInfo';
+import { SnippetResult } from './snippetResult';
+
+/**
+ * A single record
+ */
+export class Record extends null {
+ /**
+ * Unique identifier of the object
+ */
+ 'objectID': string;
+ '_highlightResult'?: HighlightResult;
+ '_snippetResult'?: SnippetResult;
+ '_rankingInfo'?: RankingInfo;
+ '_distinctSeqID'?: number;
+
+ static discriminator: string | undefined = undefined;
+
+ static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
+ {
+ name: 'objectID',
+ 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() {
+ return super.getAttributeTypeMap().concat(Record.attributeTypeMap);
+ }
+}
diff --git a/output/model/searchParams.ts b/output/model/searchParams.ts
new file mode 100644
index 00000000000..f3422011826
--- /dev/null
+++ b/output/model/searchParams.ts
@@ -0,0 +1,737 @@
+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;
+ /**
+ * 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ 'aroundRadius'?: number | 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;
+ /**
+ * Removes stop (common) words from the query before executing it.
+ */
+ 'removeStopWords'?: string;
+ /**
+ * List of characters that the engine shouldn’t automatically normalize.
+ */
+ 'keepDiacriticsOnCharacters'?: string;
+ /**
+ * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.
+ */
+ 'queryLanguages'?: 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;
+ /**
+ * 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 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;
+ /**
+ * 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;
+ /**
+ * 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: '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: '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: 'separatorsToIndex',
+ baseName: 'separatorsToIndex',
+ type: 'string',
+ },
+ {
+ name: 'aroundLatLng',
+ baseName: 'aroundLatLng',
+ type: 'string',
+ },
+ {
+ name: 'aroundLatLngViaIP',
+ baseName: 'aroundLatLngViaIP',
+ type: 'boolean',
+ },
+ {
+ name: 'aroundRadius',
+ baseName: 'aroundRadius',
+ type: 'number | 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: 'removeStopWords',
+ baseName: 'removeStopWords',
+ type: 'string',
+ },
+ {
+ name: 'keepDiacriticsOnCharacters',
+ baseName: 'keepDiacriticsOnCharacters',
+ type: 'string',
+ },
+ {
+ name: 'queryLanguages',
+ baseName: 'queryLanguages',
+ type: 'Array',
+ },
+ {
+ name: 'naturalLanguages',
+ baseName: 'naturalLanguages',
+ type: 'Array',
+ },
+ {
+ name: 'decompoundQuery',
+ baseName: 'decompoundQuery',
+ type: 'boolean',
+ },
+ {
+ name: 'enableRules',
+ baseName: 'enableRules',
+ 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: '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: '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: '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/multipleQueriesResponseHits.ts b/output/model/searchParamsString.ts
similarity index 54%
rename from output/model/multipleQueriesResponseHits.ts
rename to output/model/searchParamsString.ts
index 3e8178a67ac..d64b7587efc 100644
--- a/output/model/multipleQueriesResponseHits.ts
+++ b/output/model/searchParamsString.ts
@@ -1,22 +1,19 @@
import { RequestFile } from './models';
-export class MultipleQueriesResponseHits {
- /**
- * Unique identifier of the object
- */
- 'objectID'?: string;
+export class SearchParamsString {
+ 'params'?: string;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{ name: string; baseName: string; type: string }> = [
{
- name: 'objectID',
- baseName: 'objectID',
+ name: 'params',
+ baseName: 'params',
type: 'string',
},
];
static getAttributeTypeMap() {
- return MultipleQueriesResponseHits.attributeTypeMap;
+ return SearchParamsString.attributeTypeMap;
}
}
diff --git a/output/model/searchResponse.ts b/output/model/searchResponse.ts
new file mode 100644
index 00000000000..8d36b775a8c
--- /dev/null
+++ b/output/model/searchResponse.ts
@@ -0,0 +1,237 @@
+import { RequestFile } from './models';
+import { Record } from './record';
+import { SearchResponseFacetsStats } from './searchResponseFacetsStats';
+
+export class SearchResponse {
+ /**
+ * 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.
+ */
+ 'facets_stats'?: { [key: string]: SearchResponseFacetsStats };
+ 'hits': Array;
+ /**
+ * 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.
+ */
+ '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: 'facets_stats',
+ baseName: 'facets_stats',
+ type: '{ [key: string]: SearchResponseFacetsStats; }',
+ },
+ {
+ 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 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/package.json b/package.json
index 2cd30e6bfce..55225910817 100644
--- a/package.json
+++ b/package.json
@@ -10,21 +10,21 @@
"build:spec": "yarn swagger-cli bundle openapi_spec/spec.yml --outfile dist/openapi.yml --type yaml",
"client:build": "cd output/ && yarn install && yarn build && cd ..",
"client:test": "yarn install && tsc && node dist/app.js",
+ "client": "yarn client:build && yarn client:test",
"clean:output": "rm -rf output/*",
"clean": "rm -rf dist build node_modules"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.4.13",
"algoliasearch-client-javascript": "file:output/",
+ "dotenv": "10.0.0",
"prettier": "2.4.1",
+ "swagger-cli": "^4.0.4",
"typescript": "4.4.4"
},
"engines": {
"node": ">= 12.0.0",
"yarn": ">= 2.0.0"
},
- "packageManager": "yarn@3.0.2",
- "dependencies": {
- "swagger-cli": "^4.0.4"
- }
+ "packageManager": "yarn@3.0.2"
}
diff --git a/yarn.lock b/yarn.lock
index 7cce3e59db2..ee9958f64c4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -11,6 +11,7 @@ __metadata:
dependencies:
"@openapitools/openapi-generator-cli": ^2.4.13
algoliasearch-client-javascript: "file:output/"
+ dotenv: 10.0.0
prettier: 2.4.1
swagger-cli: ^4.0.4
typescript: 4.4.4
@@ -188,8 +189,8 @@ __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=4ddc2e&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
- checksum: 2d82602e6f0874106d06f1118faa6dc32bdfbb367ff0a454890b82b4b7f5853270f509db510aeecd178646063840b03f920a5f5ea402f492d1f9a6101abaa592
+ resolution: "algoliasearch-client-javascript@file:output/#output/::hash=fb52f6&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
+ checksum: 20ff5d88808c415a239014111cd7eb1b34a5feb33a4606088901f4d6cab484a34e5a0ebbc369fcf6e2633ed8a3ba5e0ba964bc0127f0af4974d68ebf9c363f86
languageName: node
linkType: hard
@@ -481,6 +482,13 @@ __metadata:
languageName: node
linkType: hard
+"dotenv@npm:10.0.0":
+ version: 10.0.0
+ resolution: "dotenv@npm:10.0.0"
+ checksum: f412c5fe8c24fbe313d302d2500e247ba8a1946492db405a4de4d30dd0eb186a88a43f13c958c5a7de303938949c4231c56994f97d05c4bc1f22478d631b4005
+ languageName: node
+ linkType: hard
+
"easy-table@npm:1.1.0":
version: 1.1.0
resolution: "easy-table@npm:1.1.0"