In K4, the core search only searches the content, not calling methods on the item. I would say it was the same in K3. You could try creating your own search component based on the core one and change that behaviour.
class PartyPage extends Page {
public function partyname() {
$partyName = 'foo';
return $partyName;
}
public function content(string|null $languageCode = null): Content
{
// single language support
if ($this->kirby()->multilang() === false) {
if ($this->content instanceof Content) {
return $this->content;
}
// don't normalize field keys (already handled by the `Data` class)
return $this->content = new Content(array_merge($this->readContent(), ['newField' => 'newValue']) , $this, false);
}
}
}
Something like this, merging the content from the content file with an array of extra values (I left out the multi-lang part of the original method)