Does defineSearchableAttributes() work with getter methods on the model? If I define searchable fields via IElementType::defineSearchableAttributes(), the provided fields have to be model attributes. Can they also be getter-methods on the model class, which may return values from other related elements? 

e.g. on Plugin_XYElementType.php: 

public function defineSearchableAttributes()
{
    return ['relatedTitle','otherField'],
}


in Plugin_XYModel.php:

public function getRelatedTitle()
{
    return craft()-&gt;plugin_service-&gt;getTitleFromRelatedThing($this-&gt;relatedThingId);
}


Will this fields be correctly indexed and searchable in a ElementIndexView, where I use this related fields in a table column? Or does this only work for Attributes, that were defined via defineAttributes() ?

Thanks!
I have since discovered that searching on a related model is fairly easy to implement. You just define the related model as an attribute that can be searched on in defineSearchableAttributes method of the element type.

For example:

/**
 * @inheritDoc IElementType::defineSearchableAttributes()
 *
 * @return array
 */
public function defineSearchableAttributes()
{
    return ['dateCreated', 'totalPaid', 'customer'];
}


Then you just have to have a matching handler for that attribute (customer) in the modifyElementsQuery method, like so:

    if ($criteria-&gt;customer) {
        if ($criteria-&gt;customer instanceof MyPlugin_CustomerModel) {
            if ($criteria-&gt;customer-&gt;id) {
                $criteria-&gt;customerId = $criteria-&gt;customer-&gt;id;
                $criteria-&gt;customer = null;
            } else {
                return false;
            }
        }
    }

    if ($criteria-&gt;customerId) {
        $query-&gt;andWhere(DbHelper::parseParam('orders.customerId', $criteria-&gt;customerId, $query-&gt;params));
    }


Then once search indexes are rebuilt, you'll be able to search on all attributes of a customer.