settings
This helper method iterates over the paginated API response from the
Search for synonyms API operation
and lets you run an aggregator function on every iteration.
You can use this, for example, to retrieve all synonyms from your index.
Usage
Report incorrect code
Copy
using Algolia.Search.Clients;
using Algolia.Search.Models.Search;
var appID = "ALGOLIA_APPLICATION_ID";
var apiKey = "ALGOLIA_API_KEY";
var indexName = "ALGOLIA_INDEX_NAME";
var client = new SearchClient(appID, apiKey);
var results = await client.BrowseSynonymsAsync(indexName, new SearchSynonymsParams {});
results.ToList().ForEach(synonym => Console.WriteLine($" - Synonym: {synonym.ObjectID}"));
Parameters
- C#
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Additional request options.
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Functional options to provide extra arguments.
Show available functions
Show available functions
Signature:
func(aggregator func(any, error)) iterableOptionProvides a function that runs on every iteration,
for example, to aggregate all synonyms from the response.Signature:
func(maxRetries int) iterableOptionSets the maximum number of iterations for this method.
For example, with search.WithMaxRetries(1)
this method stops after the first request.
By default,
BrowseSynoyms iterates through all pages of the API response.Signature:
func(timeout func(count int) time.Duration) iterableOptionProvides a function for calculating the waiting time between requests.
The timeout function accepts the iteration count as parameter.
This lets you implement varying timeouts.Signature:
func(key string, value string) requestOptionSets extra header parameters for this request.
To learn more, see Request options.Signature:
func(key string, value string) requestOptionSets extra query parameters for this request.
To learn more, see Request options.Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Additional request options.
Index name from which to retrieve the synonyms.
Signature:
(SearchSynonymsResponse) => voidA function that runs on every iteration,
for example, to aggregate all synonyms from the response.Parameters for the Search for synonyms request.
Signature:
(SearchSynonymsResponse) => boolA function that returns true when the iteration should stop.
By default, the iteration stops if the API response returns fewer than hitsPerPage hits.Additional request options.
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Signature:
(SearchSynonymsResponse) -> UnitA function that runs on every iteration, for example,
to aggregate all synonyms from the response.Signature:
(SearchSynonymsResponse) -> BooleanA function that returns true when the iteration should stop.
By default, the iteration stops if the API response returns fewer than hitsPerPage hits.Additional request options.
Index name from which to retrieve the synonyms.
Additional request options.
Index name from which to retrieve the synonyms.
Signature:
(SearchSynonymsResponse) -> NoneA function that runs on every iteration,
for example, to aggregate all synonyms from the response.Parameters for the Search for synonyms request.
Additional request options.
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Additional request options.
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Signature:
SearchSynonymsResponse => UnitA function that runs on every iteration, for example,
to aggregate all records from the response.Signature:
SearchSynonymsResponse => BooleanA function that returns true when the iteration should stop.
By default, the iteration stops if the API response doesn’t contain a cursor field.Additional request options.
Index name from which to retrieve the synonyms.
Parameters for the Search for synonyms request.
Signature:
(SearchSynonymsResponse) -> VoidA function that runs on every iteration, for example,
to aggregate all records from the response.Signature:
(SearchSynonymsResponse) -> BoolA function that returns true when the iteration should stop.
By default, the iteration stops if the API response doesn’t contain a cursor field.Additional request options.