diff --git a/packages/client-search/model/clientMethodProps.ts b/packages/client-search/model/clientMethodProps.ts index dda453b83..05957b075 100644 --- a/packages/client-search/model/clientMethodProps.ts +++ b/packages/client-search/model/clientMethodProps.ts @@ -25,7 +25,6 @@ import type { SearchRulesParams } from './searchRulesParams'; import type { SearchSynonymsParams } from './searchSynonymsParams'; import type { Source } from './source'; import type { SynonymHit } from './synonymHit'; -import type { SynonymType } from './synonymType'; /** * Properties for the `addOrUpdateObject` method. @@ -684,18 +683,6 @@ export type SearchSynonymsProps = { * Index on which to perform the request. */ indexName: string; - /** - * Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). - */ - type?: SynonymType; - /** - * Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there\'s no pagination. - */ - page?: number; - /** - * Maximum number of hits per page. - */ - hitsPerPage?: number; /** * Body of the `searchSynonyms` operation. */ diff --git a/packages/client-search/model/searchSynonymsParams.ts b/packages/client-search/model/searchSynonymsParams.ts index a9c3fd2a9..2e3596e25 100644 --- a/packages/client-search/model/searchSynonymsParams.ts +++ b/packages/client-search/model/searchSynonymsParams.ts @@ -1,8 +1,22 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +import type { SynonymType } from './synonymType'; + export type SearchSynonymsParams = { /** * Text to search for in an index. */ query?: string; + + type?: SynonymType; + + /** + * Page to retrieve (the first page is `0`, not `1`). + */ + page?: number; + + /** + * Number of hits per page. + */ + hitsPerPage?: number; }; diff --git a/packages/client-search/src/searchClient.ts b/packages/client-search/src/searchClient.ts index 6755e3de6..20dbbb2a8 100644 --- a/packages/client-search/src/searchClient.ts +++ b/packages/client-search/src/searchClient.ts @@ -417,31 +417,34 @@ export function createSearchClient({ * @param browseObjects.indexName - The index in which to perform the request. * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000). * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`. + * @param browseObjects.searchSynonymsParams - The `searchSynonyms` method parameters. * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions. */ browseSynonyms( { indexName, - validate, - aggregator, + searchSynonymsParams, ...browseSynonymsOptions }: BrowseOptions & SearchSynonymsProps, requestOptions?: RequestOptions ): Promise { const params = { + page: 0, + ...searchSynonymsParams, hitsPerPage: 1000, - ...browseSynonymsOptions, }; return createIterablePromise({ func: (previousResponse) => { return this.searchSynonyms( { - ...params, indexName, - page: previousResponse - ? previousResponse.page + 1 - : browseSynonymsOptions.page || 0, + searchSynonymsParams: { + ...params, + page: previousResponse + ? previousResponse.page + 1 + : params.page, + }, }, requestOptions ); @@ -2768,20 +2771,11 @@ export function createSearchClient({ * @summary Search for synonyms. * @param searchSynonyms - The searchSynonyms object. * @param searchSynonyms.indexName - Index on which to perform the request. - * @param searchSynonyms.type - Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). - * @param searchSynonyms.page - Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there\'s no pagination. - * @param searchSynonyms.hitsPerPage - Maximum number of hits per page. * @param searchSynonyms.searchSynonymsParams - Body of the `searchSynonyms` operation. * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchSynonyms( - { - indexName, - type, - page, - hitsPerPage, - searchSynonymsParams, - }: SearchSynonymsProps, + { indexName, searchSynonymsParams }: SearchSynonymsProps, requestOptions?: RequestOptions ): Promise { if (!indexName) { @@ -2797,18 +2791,6 @@ export function createSearchClient({ const headers: Headers = {}; const queryParameters: QueryParameters = {}; - if (type !== undefined) { - queryParameters.type = type.toString(); - } - - if (page !== undefined) { - queryParameters.page = page.toString(); - } - - if (hitsPerPage !== undefined) { - queryParameters.hitsPerPage = hitsPerPage.toString(); - } - const request: Request = { method: 'POST', path: requestPath,