You are here

function elasticsearch_connector_views_handler_filter_string::op_word in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_connector_views/handlers/elasticsearch_connector_views_handler_filter_string.inc \elasticsearch_connector_views_handler_filter_string::op_word()
  2. 7.2 modules/elasticsearch_connector_views/handlers/elasticsearch_connector_views_handler_filter_string.inc \elasticsearch_connector_views_handler_filter_string::op_word()

Overrides views_handler_filter_string::op_word

File

modules/elasticsearch_connector_views/handlers/elasticsearch_connector_views_handler_filter_string.inc, line 36
Handle the elasticsearch string fields filter.

Class

elasticsearch_connector_views_handler_filter_string
@file Handle the elasticsearch string fields filter.

Code

function op_word($field) {
  $where = $this->operator == 'word' ? "or" : "and";

  // Don't filter on empty strings.
  if (empty($this->value)) {
    return;
  }
  $this->query
    ->add_where($this->options['group'], array(
    'query' => array(
      'match' => array(
        $field => array(
          'query' => $this->value,
          'type' => $where,
        ),
      ),
    ),
  ));
}