-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] send an event for suggest queries
This change adds a `AfterSearchQueryHasBeenPreparedEvent` for the suggest event. Resolves: #3902
- Loading branch information
Showing
2 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Classes/Event/Search/AfterSuggestQueryHasBeenPreparedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace ApacheSolrForTypo3\Solr\Event\Search; | ||
|
||
use ApacheSolrForTypo3\Solr\Domain\Search\Query\Query; | ||
use ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest; | ||
use ApacheSolrForTypo3\Solr\Search; | ||
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration; | ||
|
||
/** | ||
* Main event when a suggest query is done by a user in the Frontend. | ||
* | ||
* This is commonly used to add components or modify the actual query. | ||
*/ | ||
final class AfterSuggestQueryHasBeenPreparedEvent | ||
{ | ||
public function __construct( | ||
private Query $query, | ||
private readonly SearchRequest $searchRequest, | ||
private readonly Search $search, | ||
private readonly TypoScriptConfiguration $typoScriptConfiguration | ||
) {} | ||
|
||
public function getQuery(): Query | ||
{ | ||
return $this->query; | ||
} | ||
|
||
public function setQuery(Query $query): void | ||
{ | ||
$this->query = $query; | ||
} | ||
|
||
public function getSearchRequest(): SearchRequest | ||
{ | ||
return $this->searchRequest; | ||
} | ||
|
||
public function getSearch(): Search | ||
{ | ||
return $this->search; | ||
} | ||
|
||
public function getTypoScriptConfiguration(): TypoScriptConfiguration | ||
{ | ||
return $this->typoScriptConfiguration; | ||
} | ||
} |