SolrSerializer.php in Search API Federated Solr 8.3
Same filename and directory in other branches
File
src/Plugin/views/style/SolrSerializer.phpView source
<?php
namespace Drupal\search_api_federated_solr\Plugin\views\style;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\rest\Plugin\views\style\Serializer;
/**
* The style plugin for serialized output formats.
*
* Add wrapper "docs" around results like Solr response object.
*
* @ingroup views_style_plugins
*
* @ViewsStyle(
* id = "solr_serializer",
* title = @Translation("Solr Serializer"),
* help = @Translation("Serializes views row data using the Serializer component."),
* display_types = {"data"}
* )
*/
class SolrSerializer extends Serializer implements CacheableDependencyInterface {
/**
* {@inheritdoc}
*/
public function render() {
$render = parent::render();
// Wrap the Solr response object around the view results.
$render = '{
"response": {
"docs":' . $render . '}
}';
return $render;
}
}
Classes
Name | Description |
---|---|
SolrSerializer | The style plugin for serialized output formats. |