Leverage the search() method to search inside arrays

I’m wondering if it’s possible to leverage the native kirby search functionality to recursively search through array entries rather than through a collection of pages.

Is it possible? I tried to search in the docs but I didn’t find anything useful.

I’ll answer my own question. Apparently no but I can reuse the search logic to perform a slightly different search for my use case.

search should work on any collection not just pages collections so you can feed your array into one and run the search then.

something like this (without proper namespaces)

$collection = new Collection($data);
$results = Search::collection($collection, $query, $params);