Skip to content

Commit

Permalink
Fix coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
carolpettirossi committed Mar 16, 2021
1 parent f680fd8 commit dfb32d1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
class SearchAPIDocumentTypeDeriver extends DeriverBase implements ContainerDeriverInterface {

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
Expand Down
2 changes: 2 additions & 0 deletions src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
class SearchAPIFieldDeriver extends DeriverBase implements ContainerDeriverInterface {

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
Expand Down
3 changes: 2 additions & 1 deletion src/Plugin/GraphQL/Fields/SearchAPIFacetValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class SearchAPIFacetValues extends FieldPluginBase {
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if (isset($value['solrFacetValues'])) {
foreach ($value['solrFacetValues'] as $facet_value) {
yield $facet_value;
yield $facet_value;
}
}
}

}
26 changes: 20 additions & 6 deletions src/Plugin/GraphQL/Fields/SearchAPISearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\graphql\GraphQL\Cache\CacheableValue;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use GraphQL\Type\Definition\ResolveInfo;
Expand Down Expand Up @@ -39,16 +38,31 @@
class SearchAPISearch extends FieldPluginBase implements ContainerFactoryPluginInterface {

/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;

/**
* The logger service.
*
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $logger;

/**
* The query object.
*
* @var \Drupal\views\Plugin\views\query\QueryPluginBase
*/
private $query;

/**
* The search index.
*
* @var \Drupal\search_api\IndexInterface
*/
private $index;

/**
Expand Down Expand Up @@ -152,7 +166,7 @@ private function addConditionGroup($condition_group_arg) {

// Set default conjunction and tags.
$group_conjunction = 'AND';
$group_tags = array();
$group_tags = [];

// Set conjunction from args.
if (isset($group['conjunction'])) {
Expand Down Expand Up @@ -256,10 +270,10 @@ private function setFacets($facets) {
/**
* Sets MLT in the Search API query.
*
* @facets
* @mlt_params
* The MLT params to be added to the query.
*/
private function setMLT($mlt_params) {
private function setMlt($mlt_params) {

// Retrieve this index server details.
$server = $this->index->getServerInstance();
Expand Down Expand Up @@ -321,7 +335,7 @@ private function prepareSearchQuery($args) {
}
// Adding more like this parameters to the query.
if ($args['more_like_this']) {
$this->setMLT($args['more_like_this']);
$this->setMlt($args['more_like_this']);
}
}

Expand All @@ -339,7 +353,7 @@ private function getSearchResponse($results) {
$search_response = [];

// Loop through each item in the result set.
foreach ($result_items as $id => &$item) {
foreach ($result_items as &$item) {
// Load the response document into the search response array.
$document['item'] = $item;
$document['index_id'] = $this->index->id();
Expand Down

0 comments on commit dfb32d1

Please sign in to comment.