You are here

private static function SearchApiElasticsearchElasticaMLT::filterFields in Search API Elasticsearch 7

More Like This can only use text type fields.

@access private

Parameters

mixed $fields:

Return value

void

1 call to SearchApiElasticsearchElasticaMLT::filterFields()
SearchApiElasticsearchElasticaMLT::build in modules/elastica/includes/SearchApiElasticsearchElasticaMLT.inc

File

modules/elastica/includes/SearchApiElasticsearchElasticaMLT.inc, line 31
Contains handler for More Like This queries.

Class

SearchApiElasticsearchElasticaMLT
@file Contains handler for More Like This queries.

Code

private static function filterFields(&$fields, SearchApiQueryInterface $query) {
  $index = $query
    ->getIndex();
  $index_fields = $index
    ->getFields();
  foreach ($index_fields as $name => $field) {
    if (!search_api_is_text_type($field['type'])) {
      $key = array_search($name, $fields);
      if ($key !== FALSE) {
        unset($fields[$key]);
      }
    }
  }
}