diff --git a/src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php b/src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php index 6cb3f77..c03000b 100644 --- a/src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php +++ b/src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php @@ -13,6 +13,8 @@ class SearchAPIDocumentTypeDeriver extends DeriverBase implements ContainerDeriverInterface { /** + * Entity type manager. + * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; diff --git a/src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php b/src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php index cf8885b..fb6bcc5 100644 --- a/src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php +++ b/src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php @@ -14,6 +14,8 @@ class SearchAPIFieldDeriver extends DeriverBase implements ContainerDeriverInterface { /** + * Entity type manager. + * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; @@ -76,13 +78,13 @@ public function getDerivativeDefinitions($base_plugin_definition) { * @field_id * The id of the field to map. */ - private function setFieldType($field, $field_id) { + protected function setFieldType($field, $field_id) { // Get field type. $type = $field->getType(); // We can only check if a field is multivalue if it has a Datasource. - // @Todo This seems inefficient, check when it's being cached + // @todo This seems inefficient, check when it's being cached $multivalue = SearchAPIHelper::checkMultivalue($field); // Map the Search API types to GraphQL. diff --git a/src/Plugin/GraphQL/Fields/SearchAPISearch.php b/src/Plugin/GraphQL/Fields/SearchAPISearch.php index 23b8148..cf6aee4 100644 --- a/src/Plugin/GraphQL/Fields/SearchAPISearch.php +++ b/src/Plugin/GraphQL/Fields/SearchAPISearch.php @@ -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; @@ -39,16 +38,31 @@ class SearchAPISearch extends FieldPluginBase implements ContainerFactoryPluginInterface { /** + * Entity type manager. + * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** + * Logger channel factory. + * * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface */ protected $logger; + /** + * Search API query. + * + * @var \Drupal\search_api\Query\QueryInterface + */ private $query; + + /** + * Search API index. + * + * @var \Drupal\search_api\IndexInterface + */ private $index; /** @@ -124,7 +138,7 @@ protected function getCacheDependencies(array $result, $value, array $args, Reso * @conditions * The conditions to be added. */ - private function addConditions($conditions) { + protected function addConditions($conditions) { // Loop through conditions to add them into the query. foreach ($conditions as $condition) { @@ -145,14 +159,14 @@ private function addConditions($conditions) { * @condition_group * The conditions to be added. */ - private function addConditionGroup($condition_group_arg) { + protected function addConditionGroup($condition_group_arg) { // Loop through the groups in the args. foreach ($condition_group_arg['groups'] as $group) { // Set default conjunction and tags. $group_conjunction = 'AND'; - $group_tags = array(); + $group_tags = []; // Set conjunction from args. if (isset($group['conjunction'])) { @@ -183,7 +197,7 @@ private function addConditionGroup($condition_group_arg) { * @params * The conditions to be added. */ - private function addSolrParams($params) { + protected function addSolrParams($params) { // Loop through conditions to add them into the query. foreach ($params as $param) { @@ -199,7 +213,7 @@ private function addSolrParams($params) { * Parameters containing fulltext keywords to be used as well as optional * fields. */ - private function setFulltextFields($full_text_params) { + protected function setFulltextFields($full_text_params) { // Check if keys is an array and if so set a conjunction. if (is_array($full_text_params['keys'])) { @@ -227,7 +241,7 @@ private function setFulltextFields($full_text_params) { * @facets * The facets to be added to the query. */ - private function setFacets($facets) { + protected function setFacets($facets) { // Retrieve this index server details. $server = $this->index->getServerInstance(); @@ -259,7 +273,7 @@ private function setFacets($facets) { * @facets * The MLT params to be added to the query. */ - private function setMLT($mlt_params) { + protected function setMLT($mlt_params) { // Retrieve this index server details. $server = $this->index->getServerInstance(); @@ -280,7 +294,7 @@ private function setMLT($mlt_params) { * @args * The arguments containing all the parameters to be loaded to the query. */ - private function prepareSearchQuery($args) { + protected function prepareSearchQuery($args) { // Prepare a query for the respective Search API index. $this->query = $this->index->query(); @@ -331,7 +345,7 @@ private function prepareSearchQuery($args) { * @results * The Search API results to be parsed. */ - private function getSearchResponse($results) { + protected function getSearchResponse($results) { // Obtain result items. $result_items = $results->getResultItems();