Passed
Push — master ( de3f0a...2890b4 )
by Timo
25:53
created

QueryBuilder::useOmitHeader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\Domain\Search\Query;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2017 <[email protected]>
8
 *  All rights reserved
9
 *
10
 *  This script is part of the TYPO3 project. The TYPO3 project is
11
 *  free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 3 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  The GNU General Public License can be found at
17
 *  http://www.gnu.org/copyleft/gpl.html.
18
 *
19
 *  This script is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  This copyright notice MUST APPEAR in all copies of the script!
25
 ***************************************************************/
26
27
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\BigramPhraseFields;
28
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Elevation;
29
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Faceting;
30
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\FieldCollapsing;
31
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Filters;
32
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Grouping;
33
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Highlighting;
34
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Operator;
35
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\PhraseFields;
36
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\QueryFields;
37
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\ReturnFields;
38
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Slops;
39
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Sorting;
40
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Sortings;
41
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\Spellchecking;
42
use ApacheSolrForTypo3\Solr\Domain\Search\Query\ParameterBuilder\TrigramPhraseFields;
43
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\SortingExpression;
44
use ApacheSolrForTypo3\Solr\Domain\Site\SiteHashService;
45
use ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository;
46
use ApacheSolrForTypo3\Solr\FieldProcessor\PageUidToHierarchy;
47
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
48
use ApacheSolrForTypo3\Solr\System\Logging\SolrLogManager;
49
use ApacheSolrForTypo3\Solr\Util;
50
use TYPO3\CMS\Core\Utility\GeneralUtility;
51
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
52
53
/**
54
 * The concrete QueryBuilder contains all TYPO3 specific initialization logic of solr queries, for TYPO3.
55
 *
56
 * @package ApacheSolrForTypo3\Solr\Domain\Search\Query
57
 */
58
class QueryBuilder extends AbstractQueryBuilder {
59
60
    /**
61
     * Additional filters, which will be added to the query, as well as to
62
     * suggest queries.
63
     *
64
     * @var array
65
     */
66
    protected $additionalFilters = [];
67
68
    /**
69
     * @var TypoScriptConfiguration
70
     */
71
    protected $typoScriptConfiguration = null;
72
73
    /**
74
     * @var SolrLogManager;
75
     */
76
    protected $logger = null;
77
78
    /**
79
     * @var SiteHashService
80
     */
81
    protected $siteHashService = null;
82
83
    /**
84
     * QueryBuilder constructor.
85
     * @param TypoScriptConfiguration|null $configuration
86
     * @param SolrLogManager|null $solrLogManager
87
     * @param SiteHashService|null $siteHashService
88
     */
89 182
    public function __construct(TypoScriptConfiguration $configuration = null, SolrLogManager $solrLogManager = null, SiteHashService $siteHashService = null)
90
    {
91 182
        $this->typoScriptConfiguration = $configuration ?? Util::getSolrConfiguration();
92 182
        $this->logger = $solrLogManager ?? GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
93 182
        $this->siteHashService = $siteHashService ?? GeneralUtility::makeInstance(SiteHashService::class);
94 182
    }
95
96
    /**
97
     * @param string $queryString
98
     * @return QueryBuilder
99
     */
100 148
    public function newSearchQuery($queryString): QueryBuilder
101
    {
102 148
        $this->queryToBuild = $this->getSearchQueryInstance($queryString);
103 148
        return $this;
104
    }
105
106
    /**
107
     * @param string $queryString
108
     * @return QueryBuilder
109
     */
110 4
    public function newSuggestQuery($queryString): QueryBuilder
111
    {
112 4
        $this->queryToBuild = $this->getSuggestQueryInstance($queryString);
113 4
        return $this;
114
    }
115
116
    /**
117
     * Initializes the Query object and SearchComponents and returns
118
     * the initialized query object, when a search should be executed.
119
     *
120
     * @param string|null $rawQuery
121
     * @param int $resultsPerPage
122
     * @param array $additionalFiltersFromRequest
123
     * @return SearchQuery
124
     */
125 136
    public function buildSearchQuery($rawQuery, $resultsPerPage = 10, array $additionalFiltersFromRequest = []) : SearchQuery
126
    {
127 136
        if ($this->typoScriptConfiguration->getLoggingQuerySearchWords()) {
128
            $this->logger->log(SolrLogManager::INFO, 'Received search query', [$rawQuery]);
129
        }
130
131
        /* @var $query SearchQuery */
132 136
        return $this->newSearchQuery($rawQuery)
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->newSearchQ...ypoScript()->getQuery() returns the type ApacheSolrForTypo3\Solr\Domain\Search\Query\Query which includes types incompatible with the type-hinted return ApacheSolrForTypo3\Solr\...earch\Query\SearchQuery.
Loading history...
133 136
                ->useResultsPerPage($resultsPerPage)
134 136
                ->useReturnFieldsFromTypoScript()
135 136
                ->useQueryFieldsFromTypoScript()
136 136
                ->useInitialQueryFromTypoScript()
137 136
                ->useFiltersFromTypoScript()
138 136
                ->useFilterArray($additionalFiltersFromRequest)
139 136
                ->useFacetingFromTypoScript()
140 136
                ->useVariantsFromTypoScript()
141 136
                ->useGroupingFromTypoScript()
142 136
                ->useHighlightingFromTypoScript()
143 136
                ->usePhraseFieldsFromTypoScript()
144 136
                ->useBigramPhraseFieldsFromTypoScript()
145 136
                ->useTrigramPhraseFieldsFromTypoScript()
146 136
                ->getQuery();
147
    }
148
149
    /**
150
     * Builds a SuggestQuery with all applied filters.
151
     *
152
     * @param string $queryString
153
     * @param array $additionalFilters
154
     * @param integer $requestedPageId
155
     * @param string $groupList
156
     * @return SuggestQuery
157
     */
158 3
    public function buildSuggestQuery(string $queryString, array $additionalFilters, int $requestedPageId, string $groupList) : SuggestQuery
159
    {
160 3
        $this->newSuggestQuery($queryString)
161 3
            ->useFiltersFromTypoScript()
162 3
            ->useSiteHashFromTypoScript($requestedPageId)
163 3
            ->useUserAccessGroups(explode(',', $groupList))
164 3
            ->useOmitHeader();
165
166
167 3
        if (!empty($additionalFilters)) {
168
            $this->useFilterArray($additionalFilters);
169
        }
170
171 3
        return $this->queryToBuild;
172
    }
173
174
    /**
175
     * Returns Query for Search which finds document for given page.
176
     * Note: The Connection is per language as recommended in ext-solr docs.
177
     *
178
     * @return Query
179
     */
180 1
    public function buildPageQuery($pageId)
181
    {
182 1
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
183 1
        $site = $siteRepository->getSiteByPageId($pageId);
184
185 1
        return $this->newSearchQuery('')
186 1
            ->useQueryString('*:*')
187 1
            ->useFilter('(type:pages AND uid:' . $pageId . ') OR (*:* AND pid:' . $pageId . ' NOT type:pages)', 'type')
188 1
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
189 1
            ->useReturnFields(ReturnFields::fromString('*'))
190 1
            ->useSortings(Sortings::fromString('type asc, title asc'))
191 1
            ->useQueryType('standard')
192 1
            ->getQuery();
193
    }
194
195
    /**
196
     * Returns a query for single record
197
     *
198
     * @return Query
199
     */
200
    public function buildRecordQuery($type, $uid, $pageId): Query
201
    {
202
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
203
        $site = $siteRepository->getSiteByPageId($pageId);
204
205
        return $this->newSearchQuery('')
206
            ->useQueryString('*:*')
207
            ->useFilter('type:' . $type . ' AND uid:' . $uid, 'type')
208
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
209
            ->useReturnFields(ReturnFields::fromString('*'))
210
            ->useSortings(Sortings::fromString('type asc, title asc'))
211
            ->useQueryType('standard')
212
            ->getQuery();
213
    }
214
215
    /**
216
     * @return QueryBuilder
217
     */
218 51
    public function useSlopsFromTypoScript(): QueryBuilder
219
    {
220 51
        return $this->useSlops(Slops::fromTypoScriptConfiguration($this->typoScriptConfiguration));
221
    }
222
223
    /**
224
     * Uses the configured boost queries from typoscript
225
     *
226
     * @return QueryBuilder
227
     */
228 51
    public function useBoostQueriesFromTypoScript(): QueryBuilder
229
    {
230 51
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
231
232 51
        if (!empty($searchConfiguration['query.']['boostQuery'])) {
233 1
            return $this->useBoostQueries($searchConfiguration['query.']['boostQuery']);
234
        }
235
236 50
        if (!empty($searchConfiguration['query.']['boostQuery.'])) {
237 1
            $boostQueries = $searchConfiguration['query.']['boostQuery.'];
238 1
            return $this->useBoostQueries(array_values($boostQueries));
239
        }
240
241 49
        return $this;
242
    }
243
244
    /**
245
     * Uses the configured boostFunction from the typoscript configuration.
246
     *
247
     * @return QueryBuilder
248
     */
249 51
    public function useBoostFunctionFromTypoScript(): QueryBuilder
250
    {
251 51
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
252 51
        if (!empty($searchConfiguration['query.']['boostFunction'])) {
253 1
            return $this->useBoostFunction($searchConfiguration['query.']['boostFunction']);
254
        }
255
256 50
        return $this;
257
    }
258
259
    /**
260
     * Uses the configured minimumMatch from the typoscript configuration.
261
     *
262
     * @return QueryBuilder
263
     */
264 51
    public function useMinimumMatchFromTypoScript(): QueryBuilder
265
    {
266 51
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
267 51
        if (!empty($searchConfiguration['query.']['minimumMatch'])) {
268 1
            return $this->useMinimumMatch($searchConfiguration['query.']['minimumMatch']);
269
        }
270
271 50
        return $this;
272
    }
273
274
    /**
275
     * @return QueryBuilder
276
     */
277 51
    public function useTieParameterFromTypoScript(): QueryBuilder
278
    {
279 51
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
280 51
        if (empty($searchConfiguration['query.']['tieParameter'])) {
281 50
            return $this;
282
        }
283
284 1
        return $this->useTieParameter($searchConfiguration['query.']['tieParameter']);
285
    }
286
287
    /**
288
     * Applies the configured query fields from the typoscript configuration.
289
     *
290
     * @return QueryBuilder
291
     */
292 136
    public function useQueryFieldsFromTypoScript(): QueryBuilder
293
    {
294 136
        return $this->useQueryFields(QueryFields::fromString($this->typoScriptConfiguration->getSearchQueryQueryFields()));
295
    }
296
297
    /**
298
     * Applies the configured return fields from the typoscript configuration.
299
     *
300
     * @return QueryBuilder
301
     */
302 136
    public function useReturnFieldsFromTypoScript(): QueryBuilder
303
    {
304 136
        $returnFieldsArray = (array)$this->typoScriptConfiguration->getSearchQueryReturnFieldsAsArray(['*', 'score']);
305 136
        return $this->useReturnFields(ReturnFields::fromArray($returnFieldsArray));
306
    }
307
308
309
310
    /**
311
     * Can be used to apply the allowed sites from plugin.tx_solr.search.query.allowedSites to the query.
312
     *
313
     * @param int $requestedPageId
314
     * @return QueryBuilder
315
     */
316 40
    public function useSiteHashFromTypoScript(int $requestedPageId): QueryBuilder
317
    {
318 40
        $queryConfiguration = $this->typoScriptConfiguration->getObjectByPathOrDefault('plugin.tx_solr.search.query.', []);
319 40
        $allowedSites = $this->siteHashService->getAllowedSitesForPageIdAndAllowedSitesConfiguration($requestedPageId, $queryConfiguration['allowedSites']);
320 40
        return $this->useSiteHashFromAllowedSites($allowedSites);
321
    }
322
323
    /**
324
     * Can be used to apply a list of allowed sites to the query.
325
     *
326
     * @param string $allowedSites
327
     * @return QueryBuilder
328
     */
329 40
    public function useSiteHashFromAllowedSites($allowedSites): QueryBuilder
330
    {
331 40
        $isAnySiteAllowed = trim($allowedSites) === '*';
332 40
        if ($isAnySiteAllowed) {
333
            // no filter required
334 1
            return $this;
335
        }
336
337 39
        $allowedSites = GeneralUtility::trimExplode(',', $allowedSites);
338 39
        $filters = [];
339 39
        foreach ($allowedSites as $site) {
340 39
            $siteHash = $this->siteHashService->getSiteHashForDomain($site);
341 39
            $filters[] = 'siteHash:"' . $siteHash . '"';
342
        }
343
344 39
        $siteHashFilterString = implode(' OR ', $filters);
345 39
        return $this->useFilter($siteHashFilterString, 'siteHash');
346
    }
347
348
    /**
349
     * Can be used to filter the result on an applied list of user groups.
350
     *
351
     * @param array $groups
352
     * @return QueryBuilder
353
     */
354 44
    public function useUserAccessGroups(array $groups): QueryBuilder
355
    {
356 44
        $groups = array_map('intval', $groups);
357 44
        $groups[] = 0; // always grant access to public documents
358 44
        $groups = array_unique($groups);
359 44
        sort($groups, SORT_NUMERIC);
360
361 44
        $accessFilter = '{!typo3access}' . implode(',', $groups);
362 44
        $this->queryToBuild->removeFilterQuery('access');
363 44
        return $this->useFilter($accessFilter, 'access');
364
    }
365
366
    /**
367
     * Applies the configured initial query settings to set the alternative query for solr as required.
368
     *
369
     * @return QueryBuilder
370
     */
371 136
    public function useInitialQueryFromTypoScript(): QueryBuilder
372
    {
373 136
        if ($this->typoScriptConfiguration->getSearchInitializeWithEmptyQuery() || $this->typoScriptConfiguration->getSearchQueryAllowEmptyQuery()) {
374
            // empty main query, but using a "return everything"
375
            // alternative query in q.alt
376 39
            $this->useAlternativeQuery('*:*');
377
        }
378
379 136
        if ($this->typoScriptConfiguration->getSearchInitializeWithQuery()) {
380 4
            $this->useAlternativeQuery($this->typoScriptConfiguration->getSearchInitializeWithQuery());
381
        }
382
383 136
        return $this;
384
    }
385
386
    /**
387
     * Applies the configured facets from the typoscript configuration on the query.
388
     *
389
     * @return QueryBuilder
390
     */
391 136
    public function useFacetingFromTypoScript(): QueryBuilder
392
    {
393 136
        return $this->useFaceting(Faceting::fromTypoScriptConfiguration($this->typoScriptConfiguration));
394
    }
395
396
    /**
397
     * Applies the configured variants from the typoscript configuration on the query.
398
     *
399
     * @return QueryBuilder
400
     */
401 136
    public function useVariantsFromTypoScript(): QueryBuilder
402
    {
403 136
        return $this->useFieldCollapsing(FieldCollapsing::fromTypoScriptConfiguration($this->typoScriptConfiguration));
404
    }
405
406
    /**
407
     * Applies the configured groupings from the typoscript configuration to the query.
408
     *
409
     * @return QueryBuilder
410
     */
411 136
    public function useGroupingFromTypoScript(): QueryBuilder
412
    {
413 136
        return $this->useGrouping(Grouping::fromTypoScriptConfiguration($this->typoScriptConfiguration));
414
    }
415
416
    /**
417
     * Applies the configured highlighting from the typoscript configuration to the query.
418
     *
419
     * @return QueryBuilder
420
     */
421 136
    public function useHighlightingFromTypoScript(): QueryBuilder
422
    {
423 136
        return $this->useHighlighting(Highlighting::fromTypoScriptConfiguration($this->typoScriptConfiguration));
424
    }
425
426
    /**
427
     * Applies the configured filters (page section and other from typoscript).
428
     *
429
     * @return QueryBuilder
430
     */
431 138
    public function useFiltersFromTypoScript(): QueryBuilder
432
    {
433 138
        $filters = Filters::fromTypoScriptConfiguration($this->typoScriptConfiguration);
434 138
        $this->queryToBuild->setFilterQueries($filters->getValues());
435
436 138
        $this->useFilterArray($this->getAdditionalFilters());
437
438 138
        $searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();
439
440 138
        if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
0 ignored issues
show
introduced by
The condition is_array($searchQueryFilters) is always true.
Loading history...
441 134
            return $this;
442
        }
443
444
        // special filter to limit search to specific page tree branches
445 4
        if (array_key_exists('__pageSections', $searchQueryFilters)) {
446 1
            $pageIds = GeneralUtility::trimExplode(',', $searchQueryFilters['__pageSections']);
447 1
            $this->usePageSectionsFromPageIds($pageIds);
448 1
            $this->typoScriptConfiguration->removeSearchQueryFilterForPageSections();
449
        }
450
451 4
        return $this;
452
    }
453
454
    /**
455
     * Applies the configured elevation from the typoscript configuration.
456
     *
457
     * @return QueryBuilder
458
     */
459 38
    public function useElevationFromTypoScript(): QueryBuilder
460
    {
461 38
        return $this->useElevation(Elevation::fromTypoScriptConfiguration($this->typoScriptConfiguration));
462
    }
463
464
    /**
465
     * Applies the configured spellchecking from the typoscript configuration.
466
     *
467
     * @return QueryBuilder
468
     */
469 34
    public function useSpellcheckingFromTypoScript(): QueryBuilder
470
    {
471 34
        return $this->useSpellchecking(Spellchecking::fromTypoScriptConfiguration($this->typoScriptConfiguration));
472
    }
473
474
    /**
475
     * Applies the passed pageIds as __pageSection filter.
476
     *
477
     * @param array $pageIds
478
     * @return QueryBuilder
479
     */
480 1
    public function usePageSectionsFromPageIds(array $pageIds = []): QueryBuilder
481
    {
482 1
        $filters = [];
483
484
        /** @var $processor PageUidToHierarchy */
485 1
        $processor = GeneralUtility::makeInstance(PageUidToHierarchy::class);
486 1
        $hierarchies = $processor->process($pageIds);
487
488 1
        foreach ($hierarchies as $hierarchy) {
489 1
            $lastLevel = array_pop($hierarchy);
490 1
            $filters[] = 'rootline:"' . $lastLevel . '"';
491
        }
492
493 1
        $pageSectionsFilterString = implode(' OR ', $filters);
494 1
        return $this->useFilter($pageSectionsFilterString, 'pageSections');
495
    }
496
497
    /**
498
     * Applies the configured phrase fields from the typoscript configuration to the query.
499
     *
500
     * @return QueryBuilder
501
     */
502 136
    public function usePhraseFieldsFromTypoScript(): QueryBuilder
503
    {
504 136
        return $this->usePhraseFields(PhraseFields::fromTypoScriptConfiguration($this->typoScriptConfiguration));
505
    }
506
507
    /**
508
     * Applies the configured bigram phrase fields from the typoscript configuration to the query.
509
     *
510
     * @return QueryBuilder
511
     */
512 136
    public function useBigramPhraseFieldsFromTypoScript(): QueryBuilder
513
    {
514 136
        return $this->useBigramPhraseFields(BigramPhraseFields::fromTypoScriptConfiguration($this->typoScriptConfiguration));
515
    }
516
517
    /**
518
     * Applies the configured trigram phrase fields from the typoscript configuration to the query.
519
     *
520
     * @return QueryBuilder
521
     */
522 136
    public function useTrigramPhraseFieldsFromTypoScript(): QueryBuilder
523
    {
524 136
        return $this->useTrigramPhraseFields(TrigramPhraseFields::fromTypoScriptConfiguration($this->typoScriptConfiguration));
525
    }
526
527
    /**
528
     * Retrieves the configuration filters from the TypoScript configuration, except the __pageSections filter.
529
     *
530
     * @return array
531
     */
532 143
    public function getAdditionalFilters() : array
533
    {
534
        // when we've build the additionalFilter once, we could return them
535 143
        if (count($this->additionalFilters) > 0) {
536 2
            return $this->additionalFilters;
537
        }
538
539 143
        $searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();
540 143
        if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
0 ignored issues
show
introduced by
The condition is_array($searchQueryFilters) is always true.
Loading history...
541 140
            return [];
542
        }
543
544 4
        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
545
546
        // all other regular filters
547 4
        foreach ($searchQueryFilters as $filterKey => $filter) {
548
            // the __pageSections filter should not be handled as additional filter
549 4
            if ($filterKey === '__pageSections') {
550 1
                continue;
551
            }
552
553 3
            $filterIsArray = is_array($searchQueryFilters[$filterKey]);
554 3
            if ($filterIsArray) {
555
                continue;
556
            }
557
558 3
            $hasSubConfiguration = is_array($searchQueryFilters[$filterKey . '.']);
559 3
            if ($hasSubConfiguration) {
560
                $filter = $cObj->stdWrap($searchQueryFilters[$filterKey], $searchQueryFilters[$filterKey . '.']);
561
            }
562
563 3
            $this->additionalFilters[$filterKey] = $filter;
564
        }
565
566 4
        return $this->additionalFilters;
567
    }
568
569
    /**
570
     * @param string $rawQuery
571
     * @return SearchQuery
572
     */
573 148
    protected function getSearchQueryInstance($rawQuery): SearchQuery
574
    {
575 148
        $query = GeneralUtility::makeInstance(SearchQuery::class);
576 148
        $query->setQuery($rawQuery);
577 148
        return $query;
578
    }
579
580
581
    /**
582
     * @param string $rawQuery
583
     * @return SuggestQuery
584
     */
585 4
    protected function getSuggestQueryInstance($rawQuery): SuggestQuery
586
    {
587 4
        $query = GeneralUtility::makeInstance(SuggestQuery::class, /** @scrutinizer ignore-type */ $rawQuery, /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);
588
589 4
        return $query;
590
    }
591
}