You are here

class StreamingExpressionQueryHelper in Search API Solr 8.3

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

Provides methods for creating streaming expressions.

Hierarchy

Expanded class hierarchy of StreamingExpressionQueryHelper

1 string reference to 'StreamingExpressionQueryHelper'
search_api_solr.services.yml in ./search_api_solr.services.yml
search_api_solr.services.yml
1 service uses StreamingExpressionQueryHelper
search_api_solr.streaming_expression_query_helper in ./search_api_solr.services.yml
Drupal\search_api_solr\Utility\StreamingExpressionQueryHelper

File

src/Utility/StreamingExpressionQueryHelper.php, line 11

Namespace

Drupal\search_api_solr\Utility
View source
class StreamingExpressionQueryHelper extends QueryHelper {

  /**
   * Builds a streaming expression for the given Search API query.
   *
   * @param \Drupal\search_api\Query\QueryInterface $query
   *   The Search API query.
   *
   * @return \Drupal\search_api_solr\Utility\StreamingExpressionBuilder
   *   The StreamingExpressionBuilder object.
   *
   * @throws \Drupal\search_api\SearchApiException
   * @throws \Drupal\search_api_solr\SearchApiSolrException
   */
  public function getStreamingExpressionBuilder(QueryInterface $query) {
    return new StreamingExpressionBuilder($query
      ->getIndex());
  }

  /**
   * Applies a streaming expression for a given Search API query.
   *
   * @param \Drupal\search_api\Query\QueryInterface $query
   *   The Search API query.
   * @param \Drupal\search_api_solr\Utility\string $streaming_expression
   *   The streaming expression to set for this query.
   * @param \Drupal\search_api_solr\Utility\string $comment
   *   A comment of the streaming expression.
   */
  public function setStreamingExpression(QueryInterface $query, string $streaming_expression, string $comment = '') {
    if ($comment) {
      $query
        ->setOption('solr_streaming_expression_comment', $comment);
    }
    $query
      ->setOption('solr_streaming_expression', $streaming_expression);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QueryHelper::$moduleHandler protected property The module handler.
QueryHelper::$null protected property NULL value to use as a key for the results storage.
QueryHelper::$parseModeManager protected property The parse mode manager.
QueryHelper::$requestStack protected property The request stack.
QueryHelper::$results protected property Storage for the results, keyed by request and search ID.
QueryHelper::addResults public function Adds a result set to the cache. Overrides QueryHelperInterface::addResults
QueryHelper::createQuery public function Creates a new search query object. Overrides QueryHelperInterface::createQuery
QueryHelper::getAllResults public function Retrieves all results data cached in this request. Overrides QueryHelperInterface::getAllResults
QueryHelper::getCurrentRequest protected function Retrieves the current request.
QueryHelper::getResults public function Retrieves the results data for a search ID. Overrides QueryHelperInterface::getResults
QueryHelper::removeResults public function Removes the result set with the given search ID from the cache. Overrides QueryHelperInterface::removeResults
QueryHelper::__construct public function Constructs a QueryHelper object.
StreamingExpressionQueryHelper::getStreamingExpressionBuilder public function Builds a streaming expression for the given Search API query.
StreamingExpressionQueryHelper::setStreamingExpression public function Applies a streaming expression for a given Search API query.