Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Limit patch #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Limit patch #22

wants to merge 2 commits into from

Conversation

kdevan
Copy link

@kdevan kdevan commented Oct 19, 2021

This request has the $builder fix as well as this limit fix. I wanted to separate them out as the $builder fix seems pretty straightforward but this limit fix could be handled different ways.

If a callback is used when searching (ex: Model::search('term', function (...args) { closure })) there is an error, "Too few arguments to function {closure}(), 3 passed and exactly 4 expected".

$builder->callback is the closure itself. Next it is expecting the builder but is receiving $documents.
If the limit is not explicitly set on the Builder then we get the error, "Devloops\LaravelTypesense\Engines\TypesenseSearchEngine::buildSearchParams(): Argument devloopsnet#3 ($perPage) must be of type int, null given". Here's a fix that works but I'd understand if you have another way that works. I hardcoded the limit to 10 because that's the Typesense default for the per_page argument: https://typesense.org/docs/0.21.0/api/documents.html#arguments.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant