Skip to content

Commit

Permalink
EZP-24092: Optimize queries to not perform count when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Feb 27, 2015
1 parent cae8030 commit 0a01595
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Controller/FolderController.php
Expand Up @@ -55,6 +55,7 @@ public function showFolderListAsideViewAction( Location $location )
$subContentQuery->sortClauses = array(
new SortClause\ContentName()
);
$subContentQuery->performCount = false;

$searchService = $this->getRepository()->getSearchService();
$subContent = $searchService->findLocations( $subContentQuery );
Expand Down
2 changes: 2 additions & 0 deletions Helper/MenuHelper.php
Expand Up @@ -73,6 +73,7 @@ public function getTopMenuContent( $topLocationId, Criterion $criterion = null )
)
);
$query->limit = $this->defaultMenuLimit;
$query->performCount = false;

return $this->searchHelper->buildListFromSearchResult( $this->repository->getSearchService()->findLocations( $query ) );
}
Expand Down Expand Up @@ -108,6 +109,7 @@ public function getLatestContent( Location $rootLocation, array $includeContentT
)
);
$query->limit = $limit ?: $this->defaultMenuLimit;
$query->performCount = false;

return $this->searchHelper->buildListFromSearchResult( $this->repository->getSearchService()->findContent( $query ) );
}
Expand Down
2 changes: 2 additions & 0 deletions Helper/PlaceHelper.php
Expand Up @@ -75,6 +75,7 @@ public function getPlaceList( Location $location, $contentTypes, $languages = ar
new Criterion\LanguageCode( $languages )
)
);
$query->performCount = false;

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

Expand Down Expand Up @@ -121,6 +122,7 @@ public function getPlaceListSorted( Location $location, $latitude, $longitude, $
)
);
$query->sortClauses = $sortClauses;
$query->performCount = false;

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

Expand Down
1 change: 1 addition & 0 deletions Menu/Builder.php
Expand Up @@ -142,6 +142,7 @@ private function getMenuItems( $rootLocationId )
)
);
$query->sortClauses = array( new Query\SortClause\Location\Path() );
$query->performCount = false;

return $this->searchService->findLocations( $query )->searchHits;
}
Expand Down

0 comments on commit 0a01595

Please sign in to comment.