You are here

class StreamingExpressionQueryHelper in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Utility/StreamingExpressionQueryHelper.php \Drupal\search_api_solr\Utility\StreamingExpressionQueryHelper
  2. 8.2 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
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.