How to include annotations of files (images) in search

Created search for entire site and found that annotations of files are not included in search.
Currently my search looks like this:

$searchResults = $site->index()->listed()->search('some search input');

p.s. here in forum are some topics about this issue, but without clear solution

Is this a duplicate of this question: Search file field meta data - #7 by Bristolscript

Yes, was not sure if that topic is still active (and originally it was regarding Kirby 2).
Thank You for pointing it out. But still a bit confused - how to add $files->search() to $site->search().
Should I make some iteration through each results page?

$files->search() only searches files, and $site->search() searches in files. But you could combine the results into a single collection.

Or check out the plugin I mentioned in the other thread.

Thank You for driving to necessary direction! Now Iā€™m able to include in search results also pages which matched file annotations (captions):

$searchResults = $site->index()->listed();
$inputParam = 'some search string';
$annotationResultsData = new Pages();

foreach ($searchResults as $currentPage) {
  $filesWithSearchData = $currentPage->files()->filter(function($file) use($inputParam, $currentPage) {
  $fileContent = $file->content()->toArray();
  $custom_caption = isset($fileContent['custom_caption']) ? $fileContent['custom_caption'] : '';
  $pos = !empty($custom_caption) ? strpos($custom_caption, $inputParam) : FALSE;

  if ($pos !== FALSE) {
    return $file;
  }

  return null;
});

  $filesLength = count($filesWithSearchData->toArray());
  if ($filesLength > 0) {
    $annotationResultsData->add($currentPage);
  }
}

$siteSearchData = $searchResults->search($inputParam);
$searchResults = $siteSearchData->merge($annotationResultsData);

p.s. feel free to comment my ugly code as my primary language is not PHP