You are here

public function RequestBuilder::build in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/Solarium/Autocomplete/RequestBuilder.php \Drupal\search_api_solr\Solarium\Autocomplete\RequestBuilder::build()
  2. 8 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\Component\ComponentAwareQueryInterface $query:

Return value

\Solarium\Core\Client\Request

File

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

Class

RequestBuilder
Autocomplete request builder.

Namespace

Drupal\search_api_solr\Solarium\Autocomplete

Code

public function build(QueryInterface $query) {
  $request = parent::build($query);
  foreach ($query
    ->getComponents() as $component) {
    $componentBuilder = $component
      ->getRequestBuilder();
    if ($componentBuilder) {
      $request = $componentBuilder
        ->buildComponent($component, $request);
    }
  }
  return $request;
}