From e08b557a9adfcea2e9af1aa5f5244f63f125ef4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 5 May 2026 17:23:47 +0200 Subject: [PATCH 1/3] Described disabling counting the results --- .../api/public_php_api/src/perform_count.php | 18 ++++++++++++++++++ docs/search/search_api.md | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 code_samples/api/public_php_api/src/perform_count.php diff --git a/code_samples/api/public_php_api/src/perform_count.php b/code_samples/api/public_php_api/src/perform_count.php new file mode 100644 index 0000000000..db61e36d73 --- /dev/null +++ b/code_samples/api/public_php_api/src/perform_count.php @@ -0,0 +1,18 @@ +performCount = false; + +$locationResult = $searchService->findLocations($locationQuery); + +// For content searches +$contentQuery = new Query(); +$contentQuery->performCount = false; + +$contentResult = $searchService->findContent($contentQuery); diff --git a/docs/search/search_api.md b/docs/search/search_api.md index e69995848e..7075ce591c 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -61,6 +61,17 @@ $output->writeln($result->getName()); $query->limit = 100; ``` +#### Disable result count + +By default, a search query also counts all matching results. +If you don't need the total count, set `performCount` to `false` on [`Query`](/api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html) or [`LocationQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationQuery.html) to improve performance, especially for large result sets. + +``` php +[[= include_code('code_samples/api/public_php_api/src/perform_count.php') =]] +``` + +When `performCount` is set to `false`, `$result->totalCount` is `null`. + #### Search with `query` and `filter` You can use two properties of the `Query` object to search for content: `query` and `filter`. From f637797bcc63aa84aadf2af378faa8d7673b0804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 6 May 2026 12:27:58 +0200 Subject: [PATCH 2/3] Fixed link --- docs/search/search_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/search/search_api.md b/docs/search/search_api.md index 7075ce591c..5775ef4e3a 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -64,7 +64,7 @@ $output->writeln($result->getName()); #### Disable result count By default, a search query also counts all matching results. -If you don't need the total count, set `performCount` to `false` on [`Query`](/api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html) or [`LocationQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationQuery.html) to improve performance, especially for large result sets. +If you don't need the total count, set `performCount` to `false` on [`Query`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html) or [`LocationQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationQuery.html) to improve performance, especially for large result sets. ``` php [[= include_code('code_samples/api/public_php_api/src/perform_count.php') =]] From 4dd2d71a2df34741ee7bbcde3fc69ea28086561a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 7 May 2026 15:20:38 +0200 Subject: [PATCH 3/3] Update docs/search/search_api.md Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> --- docs/search/search_api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/search/search_api.md b/docs/search/search_api.md index 5775ef4e3a..753c8360cd 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -67,7 +67,9 @@ By default, a search query also counts all matching results. If you don't need the total count, set `performCount` to `false` on [`Query`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query.html) or [`LocationQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationQuery.html) to improve performance, especially for large result sets. ``` php -[[= include_code('code_samples/api/public_php_api/src/perform_count.php') =]] +[[= include_code('code_samples/api/public_php_api/src/perform_count.php', 8, 10) =]] + +[[= include_code('code_samples/api/public_php_api/src/perform_count.php', 14, 16) =]] ``` When `performCount` is set to `false`, `$result->totalCount` is `null`.