How to filter search results #41
-
DescriptionIs there a way to use filters in a search? Typical use is to have a drop-down list to filter the results. Something like:
In the README I can see EnvironmentEnvironment Cache Drivers Statamic Statamic Addons |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you're using the 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) |
Beta Was this translation helpful? Give feedback.
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#overviewIf you're happy to roll your own tag, you could hook into the search facade: