Skip to content

The raw() method always returns the first 250 results #944

@bessone

Description

@bessone

Scout Version

10.19.0

Scout Driver

Typesense

Laravel Version

12.28.1

PHP Version

8.4

Database Driver & Version

No response

SDK Version

No response

Meilisearch CLI Version

No response

Description

When performing a search that returns more than 250 results (for example, 300), the raw() method returns only the first 250 results.

The Typesense documentation (https://typesense.org/docs/29.0/api/search.html#pagination-parameters) states that using the per_page parameter returns a maximum of 250 hits.
"NOTE: Only up to 250 hits (or groups of hits when using group_by) can be fetched per page."

The problem with scout is that it doesn't return the results from the current page, but always the first 250.

For example, when paging 50 results per page, the 300 results returned only display hits on the first 5 pages; the sixth page won't work.

Steps To Reproduce

`$results= Model::search($query)->paginate(50)->withQueryString();

$raw = $search->raw();

// Add hits to model result
foreach ($results &$result) {
foreach($raw['hits'] as $hit) {
if ($hit['document']['id'] == (string) $result->id) {
$case->hit = $hit;
break;
}
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions