Skip to content
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

[10.x] afterRawSearch callback #904

Open
wants to merge 13 commits into
base: 10.x
Choose a base branch
from

Conversation

gdebrauwer
Copy link
Contributor

Typesense provides an option to get facet results. That facet info can be found underneath the 'facet_counts' key on the raw search response, next to the 'results' key. Currently, there is no easy way to access that extra search info (such as facet info) that is returned by the search engine. This PR provides an easy way access to access the full search result response returned by the search engine:

Product::search($request->query('q'))
    ->options(['facet_by' => 'category_ids'])
    ->afterRawSearch(function (array $result) {
        dump($result['facet_counts']); // access facet results
    })
    ->paginate();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant