browse
This helper method iterates over the paginated API response from the Browse API operation
and lets you run an aggregator function on every iteration.
You can use this, for example, to retrieve all records 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 client = new SearchClient(appID, apiKey);
var results = await client.BrowseObjectsAsync<Hit>("ALGOLIA_INDEX_NAME", new BrowseParamsObject { Query = "test" });
results.ToList().ForEach(record => Console.WriteLine($" - Record: {record.ObjectID}"));
Parameters
- C#
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
Index name from which to retrieve the records.
Parameters for the Browse for records request.
The model for your records, for example,
Algolia.Search.Models.Search.Hit.Additional request options.
Index name from which to retrieve the records.
Parameters for the Browse for records 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 records 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,
BrowseObjects 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 records.
Parameters for the Browse for records request.
The model for your records, for example,
com.algolia.model.search.Hit.Additional request options.
Index name from which to retrieve the records.
Signature:
(BrowseResponse) => voidA function that runs on every iteration,
for example, to aggregate all records from the response.Parameters for the Browse for records request.
Signature:
(BrowseResponse) => boolA function that returns true when the iteration should stop.
By default, the iteration stops if the API response doesn’t contain a cursor property.Additional request options.
Index name from which to retrieve the records.
Parameters for the Browse for records request.
Signature:
(BrowseResponse) -> UnitA function that runs on every iteration, for example,
to aggregate all records from the response.Signature:
(BrowseResponse) -> 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 records.
Additional request options.
Index name from which to retrieve the records.
Signature:
(BrowseResponse) -> NoneA function that runs on every iteration,
for example, to aggregate all records from the response.Parameters for the Browse for records request.
Additional request options.
Index name from which to retrieve the records.
Parameters for the Browse for records request.
Additional request options.
Index name from which to retrieve the records.
Parameters for the Browse for records request.
Signature:
BrowseResponse => UnitA function that runs on every iteration, for example,
to aggregate all records from the response.T is your record model’s type.Signature:
BrowseResponse => 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.T is your record model’s type.Additional request options.
Index name from which to retrieve the records.
Parameters for the Browse for records request.
Signature:
(BrowseResponse<T>) -> VoidA function that runs on every iteration, for example,
to aggregate all records from the response.T is your record model’s type.Signature:
(BrowseResponse<T>) -> 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.T is your record model’s type.Additional request options.