Skip to content

Commit 1ac7720

Browse files
author
André R
committed
EZP-24092: Optimize queries to not perform count when not needed
(cherry picked from commit 0a01595) Conflicts: Controller/FolderController.php
1 parent eae2dd6 commit 1ac7720

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

Helper/MenuHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public function getTopMenuContent( $topLocationId, Criterion $criterion = null )
7373
)
7474
);
7575
$query->limit = $this->defaultMenuLimit;
76+
$query->performCount = false;
7677

7778
return $this->searchHelper->buildListFromSearchResult( $this->repository->getSearchService()->findLocations( $query ) );
7879
}
@@ -108,6 +109,7 @@ public function getLatestContent( Location $rootLocation, array $includeContentT
108109
)
109110
);
110111
$query->limit = $limit ?: $this->defaultMenuLimit;
112+
$query->performCount = false;
111113

112114
return $this->searchHelper->buildListFromSearchResult( $this->repository->getSearchService()->findContent( $query ) );
113115
}

Helper/PlaceHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public function getPlaceList( $locationId, $contentTypes, $languages = array() )
8484
new Criterion\LanguageCode( $languages )
8585
)
8686
);
87+
$query->performCount = false;
8788

8889
$searchResults = $this->searchService->findContent( $query );
8990

@@ -132,6 +133,7 @@ public function getPlaceListSorted( $locationId, $latitude, $longitude, $content
132133
)
133134
);
134135
$query->sortClauses = $sortClauses;
136+
$query->performCount = false;
135137

136138
$searchResults = $this->searchService->findContent( $query );
137139

Menu/Builder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ private function getMenuItems( $rootLocationId )
142142
)
143143
);
144144
$query->sortClauses = array( new Query\SortClause\Location\Path() );
145+
$query->performCount = false;
145146

146147
return $this->searchService->findLocations( $query )->searchHits;
147148
}

0 commit comments

Comments
 (0)