Skip to content

Commit

Permalink
[FEATURE] Allow wildcard search
Browse files Browse the repository at this point in the history
  • Loading branch information
thommyhh committed Mar 10, 2023
1 parent 774d5fe commit 3d707cf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Classes/Backend/IndexedSearchBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class IndexedSearchBackend extends AbstractBackend
*/
protected $searchRepository = null;

public const WILDCARD_START = 'start';
public const WILDCARD_END = 'end';
public const WILDCARD_BOTH = 'both';

public function initialize()
{
$this->searchRepository = GeneralUtility::makeInstance(IndexSearchRepository::class);
Expand Down Expand Up @@ -114,6 +118,19 @@ protected function initializeSearchRepository($searchData, int $itemsPerPage)
$searchData['numberOfResults'] = $itemsPerPage;
$searchData['sortOrder'] = 'rank_flag';
$searchData['mediaType'] = '-1'; // Search for everything
if ($this->settings['enableWildcard']) {
switch ($this->settings['enableWildcard']) {
case self::WILDCARD_START:
$searchData['searchType'] = 3;
break;
case self::WILDCARD_END:
$searchData['searchType'] = 2;
break;
case self::WILDCARD_BOTH:
$searchData['searchType'] = 1;
break;
}
}
$this->searchRepository->initialize(
[
'searchSkipExtendToSubpagesChecking' => true,
Expand Down

0 comments on commit 3d707cf

Please sign in to comment.