You are here

protected function SearchApiElasticsearchConnector::normalizeFulltextQuery in Elasticsearch Connector 7

Same name and namespace in other branches
  1. 7.5 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::normalizeFulltextQuery()
  2. 7.2 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::normalizeFulltextQuery()

Parameters

array $queries:

string $conjunction:

1 call to SearchApiElasticsearchConnector::normalizeFulltextQuery()
SearchApiElasticsearchConnector::parseFilter in modules/elasticsearch_connector_search_api/service.inc
Recursively parse Search API filters.

File

modules/elasticsearch_connector_search_api/service.inc, line 739
Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.

Class

SearchApiElasticsearchConnector
Search service class.

Code

protected function normalizeFulltextQuery($queries, $conjunction) {
  if ($conjunction === 'OR') {
    $queries = array(
      array(
        'bool' => array(
          'should' => $queries,
          'minimum_should_match' => '1',
        ),
      ),
    );
  }
  elseif ($conjunction === 'AND') {
    $queries = array(
      array(
        'bool' => array(
          'must' => $queries,
        ),
      ),
    );
  }
  return $queries;
}