Skip to content

How to filter search results #41

Answered by ryanmitchell
earthwytch asked this question in Help
Discussion options

You must be logged in to vote

If you're using the search:results tag then theres no way currently of passing filters to the search function - you can use conditions and query scopes on the results that come back to do filtering on the Statamic side: https://statamic.dev/conditions#overview

If you're happy to roll your own tag, you could hook into the search facade:

\Statamic\Facades\Search::index('your_index')
            ->ensureExists()
            ->searchUsingApi($query, $your_mielisearch_options_as_an_array)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@earthwytch
Comment options

Answer selected by earthwytch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants