You are here

public static function Utility::buildSuggesterContextFilterQuery in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::buildSuggesterContextFilterQuery()
  2. 4.x src/Utility/Utility.php \Drupal\search_api_solr\Utility\Utility::buildSuggesterContextFilterQuery()

Builds the filter query for a Suggester context given an array of tags.

Parameters

array $tags: An array of tags as strings.

Return value

string The resulting filter query.

1 call to Utility::buildSuggesterContextFilterQuery()
SearchApiSolrBackend::setAutocompleteSuggesterQuery in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Set the suggester parameters for the solarium autocomplete query.

File

src/Utility/Utility.php, line 446

Class

Utility
Provides various helper functions for Solr backends.

Namespace

Drupal\search_api_solr\Utility

Code

public static function buildSuggesterContextFilterQuery(array $tags) {
  $cfg = [];
  foreach ($tags as $tag) {
    $cfg[] = '+' . self::encodeSolrName($tag);
  }
  return implode(' ', $cfg);
}