I am trying to search() for users that can be selected on several pages.
I used users to store information about contacts, team members and so on. On several pages there is a userSelect field where editors can add contacts to pages or add team members to team pages.
Now i want the search() function to be able to find the names of these users on the pages where they are used. But kirby stores only the user object inside the content’s .txt file.
How could I add the user name(s) to the content so the search query can find it/them?
my query is very basic:
<?php
return function ($site) {
$query = trim((string)get(‘q’));
$results = $site
->index()
->not(page(‘error’), page(‘impressum’), page(‘datenschutz’))
->search($query)
->paginate(20);
return [
'query' => $query,
‘results’ => $results,
‘pagination’ => $results->pagination(),
‘searchExcerpt’ => $searchExcerpt
];
};