All add-ons

Low Search

Just $79.00 per license

Compatibility: EE2, EE3
Latest release: 5.1.0 (released 2017-03-23)
Licensing: Commercial License Agreement

Custom fields and indexes

If your custom field type stores something else in the exp_channel_data table than what needs to be indexed, you can add Low Search compatibility to your custom field type. Just add a public method third_party_search_index($field_data) to your field type class, and you’re good to go.

third_party_search_index is given one parameter: (string) $data, the field data currently in the database. Furthermore, all field settings are available through $this->settings, including $this->settings['entry_id'] for the current entry and $this->settings['low_search_collection_id'] for the current collection id. The method should return a string that is used for the search index. The string will be sanitized by Low Search and the field weight will be added automatically as well.

Example

public function third_party_search_index($data)
{
  $query = $this->EE->db->select('real_content')
         ->from('custom_table')
         ->where('entry_id', $this->settings['entry_id'])
         ->where('other_key', $data)
         ->get();

  return $query->row('real_content');
}