Is there a way to specify that something like $pages->search() should actively call certain methods defined in a Page Model?
For example, let’s say I have a computed property like “Store Name” that’s derived from some numeric identifier that’s store in a Kirby page.
I’m going to assume this isn’t actually possible; is the suggested approach to run a separate “search” with a $pages->filter() call and do searching myself? In the case where I want a universal search, I guess I’d just merge the results from $pages->search() and $pages->filter()?
This doesn’t seem to be possible, not even with map(). While you can use such custom methods in filter and sort methods, it doesn’t work with search. So I guess merging results from search and filter would be the easiest way.
search is a method of the Pages class. You will find it at kirby/core/pages.php on line 172. One thing I would try is to create a custom pages method and copy the content from the search method to change it to your needs.
Around line 203 it gets the page content. That’s where you can merge the data from models.