Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Classes/Controller/SuggestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ protected function buildRequestForTerm(string $term, string $contextNodeIdentifi
->queryFilter('prefix', [
'neos_completion' => $termPlaceholder
])
->limit(0)
->aggregation('autocomplete', [
->limit(0);

if (($this->searchAsYouTypeSettings['autocomplete']['enabled'] ?? false) === true) {
$query->aggregation('autocomplete', [
'terms' => [
'field' => 'neos_completion',
'order' => [
Expand All @@ -139,8 +141,11 @@ protected function buildRequestForTerm(string $term, string $contextNodeIdentifi
'include' => $termPlaceholder . '.*',
'size' => $this->searchAsYouTypeSettings['autocomplete']['size'] ?? 10
]
])
->suggestions('suggestions', [
]);
}

if (($this->searchAsYouTypeSettings['suggestions']['enabled'] ?? false) === true) {
$query->suggestions('suggestions', [
'prefix' => $termPlaceholder,
'completion' => [
'field' => 'neos_suggestion',
Expand All @@ -152,6 +157,7 @@ protected function buildRequestForTerm(string $term, string $contextNodeIdentifi
]
]
]);
}

$request = $query->getRequest()->toArray();

Expand Down
2 changes: 2 additions & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Flowpack:
searchAsYouType:
autocomplete:
size: 10
enabled: true
suggestions:
size: 10
enabled: true
sourceFields:
- neos_path
- title