1

When using the Search methods, the documentation states that the data may not be returned all at once. If it is not then you will get a continuationToken and you will have to call the search again.

This is how I have it coded up.

    var searchResult = await indexClient.Documents.SearchAsync<T>(searchText, parameters);
    var continuationToken = searchResult.ContinuationToken;

    var list = searchResult.Results.Select(o => o.Document).ToList();

    while (continuationToken != null)
    {
        searchResult = await indexClient.Documents.ContinueSearchAsync<T>(continuationToken);
        continuationToken = searchResult.ContinuationToken;
        list.AddRange( searchResult.Results.Select(o => o.Document));
    }

    return list;

The question I have is... Do I actually have to maintain a list of the results or is the data going to be appended internally to the searchResult and I only have to grab the data right before I return?

Webbert
  • 51
  • 6

0 Answers0