6
6
use Drupal \Core \Entity \EntityTypeManagerInterface ;
7
7
use Drupal \Core \Logger \LoggerChannelFactoryInterface ;
8
8
use Drupal \Core \Plugin \ContainerFactoryPluginInterface ;
9
- use Drupal \graphql \GraphQL \Cache \CacheableValue ;
10
9
use Drupal \graphql \Plugin \GraphQL \Fields \FieldPluginBase ;
11
10
use Drupal \graphql \GraphQL \Execution \ResolveContext ;
12
11
use GraphQL \Type \Definition \ResolveInfo ;
39
38
class SearchAPISearch extends FieldPluginBase implements ContainerFactoryPluginInterface {
40
39
41
40
/**
41
+ * The entity type manager service.
42
+ *
42
43
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
43
44
*/
44
45
protected $ entityTypeManager ;
45
46
46
47
/**
48
+ * The logger service.
49
+ *
47
50
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
48
51
*/
49
52
protected $ logger ;
50
53
54
+ /**
55
+ * The query object.
56
+ *
57
+ * @var \Drupal\views\Plugin\views\query\QueryPluginBase
58
+ */
51
59
private $ query ;
60
+
61
+ /**
62
+ * The search index.
63
+ *
64
+ * @var \Drupal\search_api\IndexInterface
65
+ */
52
66
private $ index ;
53
67
54
68
/**
@@ -152,7 +166,7 @@ private function addConditionGroup($condition_group_arg) {
152
166
153
167
// Set default conjunction and tags.
154
168
$ group_conjunction = 'AND ' ;
155
- $ group_tags = array () ;
169
+ $ group_tags = [] ;
156
170
157
171
// Set conjunction from args.
158
172
if (isset ($ group ['conjunction ' ])) {
@@ -256,10 +270,10 @@ private function setFacets($facets) {
256
270
/**
257
271
* Sets MLT in the Search API query.
258
272
*
259
- * @facets
273
+ * @mlt_params
260
274
* The MLT params to be added to the query.
261
275
*/
262
- private function setMLT ($ mlt_params ) {
276
+ private function setMlt ($ mlt_params ) {
263
277
264
278
// Retrieve this index server details.
265
279
$ server = $ this ->index ->getServerInstance ();
@@ -321,7 +335,7 @@ private function prepareSearchQuery($args) {
321
335
}
322
336
// Adding more like this parameters to the query.
323
337
if ($ args ['more_like_this ' ]) {
324
- $ this ->setMLT ($ args ['more_like_this ' ]);
338
+ $ this ->setMlt ($ args ['more_like_this ' ]);
325
339
}
326
340
}
327
341
@@ -339,7 +353,7 @@ private function getSearchResponse($results) {
339
353
$ search_response = [];
340
354
341
355
// Loop through each item in the result set.
342
- foreach ($ result_items as $ id => &$ item ) {
356
+ foreach ($ result_items as &$ item ) {
343
357
// Load the response document into the search response array.
344
358
$ document ['item ' ] = $ item ;
345
359
$ document ['index_id ' ] = $ this ->index ->id ();
0 commit comments