-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search results very complex to browse #31
Comments
The way the
As your search (or aggregate) can have multiple page, you can request the next page: // If your RediSearch search have 15 results in total, but you set the pagination to 10 per page:
/** @var PaginatedResponse $results */
/** @var array<SearchResponseItem> $items */
$items = $results->current();
// $items is a list of 10 SearchResponseItem
$results->next();
/** @var array<SearchResponseItem> $items */
$items = $results->current();
// $items is a list of 5 SearchResponseItem The sister project macfja/redisearch-integration have a special PHP Iterator ( /** @var \MacFJA\RediSearch\Redis\Client $client */
/** @var \MacFJA\RediSearch\Redis\Command\Search $search */
$results = $client->execute($search);
$allItems = new \MacFJA\RediSearch\Integration\Iterator\ResponseItemIterator($results, $client);
/** @var \MacFJA\RediSearch\Redis\Response\SearchResponseItem $item */
foreach ($allItems as $item) {
// $item is a "document" result for RediSearch
echo $item->getField('name');
} I will write a documentation on how the |
Hello MacJFA,
(using version 2.1.0)
I wanted to share with you that I find it very hard for a newcomer to simply browse the results of a search, this is the current method I use.
I do not really get why I have to get $results[0] to get to the actual results. (I could also do a $results->current() I suppose, but the problem stays the same).
Also, thanks a million for your hard work on this library !
The text was updated successfully, but these errors were encountered: