You are here

public function RequestBuilder::build in Search API Solr 8.3

Same name and namespace in other branches
  1. 8 src/Solarium/Autocomplete/RequestBuilder.php \Drupal\search_api_solr\Solarium\Autocomplete\RequestBuilder::build()
  2. 8.2 src/Solarium/Autocomplete/RequestBuilder.php \Drupal\search_api_solr\Solarium\Autocomplete\RequestBuilder::build()
  3. 4.x src/Solarium/Autocomplete/RequestBuilder.php \Drupal\search_api_solr\Solarium\Autocomplete\RequestBuilder::build()

Build request for an autocomplete query.

Parameters

\Solarium\Core\Query\AbstractQuery $query: The Solarium query.

Return value

\Solarium\Core\Client\Request The Solarium request.

File

src/Solarium/Autocomplete/RequestBuilder.php, line 23

Class

RequestBuilder
Autocomplete request builder.

Namespace

Drupal\search_api_solr\Solarium\Autocomplete

Code

public function build(AbstractQuery $query) : Request {

  /** @var \Drupal\search_api_solr\Solarium\Autocomplete\Query $query */
  $request = parent::build($query);
  foreach ($query
    ->getComponents() as $component) {
    $componentBuilder = $component
      ->getRequestBuilder();
    if ($componentBuilder) {
      $request = $componentBuilder
        ->buildComponent($component, $request);
    }
  }
  return $request;
}