Skip to content

Commit

Permalink
Add BC layer for track-total-hits (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored Nov 18, 2021
1 parent bbb450e commit 5afcd45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Controller/ArticleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ function(FieldDescriptorInterface $fieldDescriptor) use ($fields) {
$search->setScroll('1m');
}

if (method_exists($search, 'setTrackTotalHits')) {
$search->setTrackTotalHits(true);
}

$searchResult = $repository->findRaw($search);
$result = [];
foreach ($searchResult as $document) {
Expand Down
11 changes: 11 additions & 0 deletions Resources/doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ sulu_route:
parent: '{object.getParent().getRoutePath()}'

ongr_elasticsearch:
# If you expect more than 10000 articles, you need to set the `max_result_window` to an appropriate number
# managers:
# default:
# index:
# settings:
# max_result_window: 20000
# live:
# index:
# settings:
# max_result_window: 20000

analysis:
tokenizer:
pathTokenizer:
Expand Down

0 comments on commit 5afcd45

Please sign in to comment.