Closed Tontyna closed 4 years ago
Hey!
You're absolutely right and I've been thinking about changing my plugins to work this way for some time now. This is a good reason to finally do it 🙂
The plugin is updated now as of ba5fabdfdc7031c69a3bef68a1dec74e4ee173dc.
Note that the solution is somewhat different than your suggestion. Instead of filtering the array manually, you run the pages array through a filter: {% set search_results = pages|apply_search %}
. You can then use the resulting array as you wish.
Of course, a Twig filter is/was the right way to go :heart:
Awesome, Thanks for rewriting it. Just encountered the same problem!
First of all: Thanks for this plugin.
In
onPagesLoaded
the plugin filters the$pages
array and removes all pages withoutsearch_rank
. This interferes with my theme that requires the complete pages array for its own purpose (cf. the pico default theme).Commented out the filtering lines https://github.com/PontusHorn/Pico-Search/blob/b539f8e3596e6048aac9fee534565b91a2f505c3/40-PicoSearch.php#L111-L113
Modified my
search.twig
to do the filtering:Theme works as expected again.