ResponseParser.php in Search API Solr 4.x
File
src/Solarium/Autocomplete/ResponseParser.php
View source
<?php
namespace Drupal\search_api_solr\Solarium\Autocomplete;
use Solarium\Core\Query\AbstractResponseParser;
use Solarium\Core\Query\ResponseParserInterface;
use Solarium\Core\Query\Result\ResultInterface;
class ResponseParser extends AbstractResponseParser implements ResponseParserInterface {
public function parse(ResultInterface $result) : array {
$data = $result
->getData();
$query = $result
->getQuery();
$components = [];
foreach ($query
->getComponents() as $component) {
$componentParser = $component
->getResponseParser();
if ($componentParser) {
$components[$component
->getType()] = $componentParser
->parse($query, $component, $data);
}
}
return $this
->addHeaderInfo($data, [
'components' => $components,
]);
}
}