@@ -27,13 +27,6 @@ For example, to search for all content of a selected content type, use one Crite
2727
2828The following command takes the content type identifier as an argument and lists all results:
2929
30- ``` php hl_lines="14 16"
31- // ...
32- [[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 4, 7) =]]// ...
33- [[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 17, 19) =]] // ...
34- [[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 32, 48) =]]
35- [[= include_file('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 48, 49) =]]
36- ```
3730``` php hl_lines="14 16"
3831// ...
3932[[= include_code('code_samples/api/public_php_api/src/Command/FindContentCommand.php', 5, 7) =]]
@@ -127,12 +120,6 @@ It doesn't use the `SearchService` and isn't based on indexed data.
127120
128121For example, the following command lists all content items under the specified parent location and sorts them by name in descending order:
129122
130- ``` php hl_lines="15-18"
131- // ...
132- [[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 4, 9) =]]
133- // ...
134- [[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 19, 21) =]][[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 33, 53) =]]
135- ```
136123``` php hl_lines="15-18"
137124// ...
138125[[= include_code('code_samples/api/public_php_api/src/Command/FilterCommand.php', 5, 9) =]]
@@ -144,12 +131,6 @@ For example, the following command lists all content items under the specified p
144131
145132The same Filter can be applied to find locations instead of content items, for example:
146133
147- ``` php hl_lines="20"
148- // ...
149- [[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 4, 9) =]]
150- [[= include_file('code_samples/api/public_php_api/src/Command/FilterCommand.php', 19, 21) =]]// ...
151- [[= include_file('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 33, 53) =]]
152- ```
153134``` php hl_lines="20"
154135// ...
155136[[= include_code('code_samples/api/public_php_api/src/Command/FilterLocationCommand.php', 5, 9) =]]
@@ -206,11 +187,6 @@ $filter
206187You can use the ` SearchService ` or repository filtering in a controller, as long as you provide the required parameters.
207188For example, in the code below, ` locationId ` is provided to list all children of a location by using the ` SearchService ` .
208189
209- ``` php hl_lines="22-24"
210- // ...
211- [[= include_file('code_samples/api/public_php_api/src/Controller/CustomController.php', 4, 12) =]] // ...
212- [[= include_file('code_samples/api/public_php_api/src/Controller/CustomController.php', 16, 32) =]]
213- ```
214190``` php hl_lines="22-24"
215191// ...
216192[[= include_code('code_samples/api/public_php_api/src/Controller/CustomController.php', 5, 12) =]]
@@ -222,11 +198,6 @@ The rendering of results is then relegated to [templates](templates.md) (lines 2
222198
223199When using Repository filtering, provide the results of ` ContentService::find() ` as parameters to the view:
224200
225- ``` php hl_lines="19"
226- // ...
227- [[= include_file('code_samples/api/public_php_api/src/Controller/CustomFilterController.php', 4, 12) =]] // ...
228- [[= include_file('code_samples/api/public_php_api/src/Controller/CustomFilterController.php', 16, 31) =]]
229- ```
230201``` php hl_lines="19"
231202// ...
232203[[= include_code('code_samples/api/public_php_api/src/Controller/CustomFilterController.php', 5, 12) =]]
@@ -238,11 +209,6 @@ When using Repository filtering, provide the results of `ContentService::find()`
238209
239210To paginate search or filtering results, it's recommended to use the [ Pagerfanta library] ( https://github.com/BabDev/Pagerfanta ) and [[[ = product_name =]] 's adapters for it.] ( https://github.com/ibexa/core/blob/main/src/lib/Pagination/Pagerfanta/Pagerfanta.php )
240211
241- ``` php
242- // ...
243- [[= include_file('code_samples/api/public_php_api/src/Controller/PaginationController.php', 8, 15) =]] // ...
244- [[= include_file('code_samples/api/public_php_api/src/Controller/PaginationController.php', 19, 39) =]]
245- ```
246212``` php
247213// ...
248214[[= include_code('code_samples/api/public_php_api/src/Controller/PaginationController.php', 9, 15) =]]
@@ -252,9 +218,6 @@ To paginate search or filtering results, it's recommended to use the [Pagerfanta
252218
253219Pagination can then be rendered for example using the following template:
254220
255- ``` html+twig
256- [[= include_file('code_samples/api/public_php_api/templates/themes/standard/full/custom_pagination.html.twig') =]]
257- ```
258221``` html+twig
259222[[= include_code('code_samples/api/public_php_api/templates/themes/standard/full/custom_pagination.html.twig') =]]
260223```
@@ -286,11 +249,6 @@ For more information and examples, see [PagerFanta documentation](https://www.ba
286249For more complex searches, you need to combine multiple Criteria.
287250You can do it using logical operators: ` LogicalAnd ` , ` LogicalOr ` , and ` LogicalNot ` .
288251
289- ``` php
290- [[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 44, 49) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 53, 54) =]]
291- [[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 60, 65) =]]
292-
293- ```
294252``` php
295253[[= include_code('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 45, 49) =]]
296254[[= include_code('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 54, 54) =]]
@@ -308,9 +266,6 @@ You can also nest different operators to construct more complex queries.
308266The example below uses the ` LogicalNot ` operator to search for all content containing a given phrase
309267that doesn't belong to the provided Section:
310268
311- ``` php
312- [[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 46, 54) =]]
313- ```
314269``` php
315270[[= include_code('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 47, 54) =]]
316271```
@@ -344,9 +299,6 @@ To sort the results of a query, use one of more [Sort Clauses](sort_clause_refer
344299
345300For example, to order search results by their publication date, from oldest to newest, and then alphabetically by content name, add the following Sort Clauses to the query:
346301
347- ``` php
348- [[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 55, 59) =]]
349- ```
350302``` php
351303[[= include_code('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 56, 59) =]]
352304```
@@ -365,9 +317,6 @@ With aggregations you can find the count of search results or other result infor
365317
366318To do this, you use of the query's ` $aggregations ` property:
367319
368- ``` php
369- [[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 30, 35) =]]
370- ```
371320``` php
372321[[= include_code('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 31, 35) =]]
373322```
@@ -376,18 +325,12 @@ The name of the aggregation must be unique in the given query.
376325
377326Access the results by using the ` get() ` method of the aggregation:
378327
379- ``` php
380- [[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 39, 40) =]]
381- ```
382328``` php
383329[[= include_code('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 40, 40) =]]
384330```
385331
386332Aggregation results contain the name of the result and the count of found items:
387333
388- ``` php
389- [[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 42, 45) =]]
390- ```
391334``` php
392335[[= include_code('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 43, 45) =]]
393336```
@@ -397,19 +340,13 @@ In this case the aggregation takes the content type identifier and the field ide
397340
398341The following example creates an aggregation named ` selection ` that groups results according to the value of the ` topic ` field in the ` article ` content type:
399342
400- ``` php
401- [[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 35, 36) =]]
402- ```
403343``` php
404344[[= include_code('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 36, 36) =]]
405345```
406346
407347With term aggregation you can define additional limits to the results.
408348The following example limits the number of terms returned to 5 and only considers terms that have 10 or more results:
409349
410- ``` php
411- [[= include_file('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 30, 33) =]]
412- ```
413350``` php
414351[[= include_code('code_samples/api/public_php_api/src/Command/FindWithAggregationCommand.php', 31, 33) =]]
415352```
@@ -466,9 +403,6 @@ You build an `EmbeddingQuery` instance by using a builder and pass it to the sea
466403
467404This example shows a minimal embedding query executed directly through the search service:
468405
469- ``` php hl_lines="38-39 41-47 49"
470- [[= include_file('code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php') =]]
471- ```
472406``` php hl_lines="38-39 41-47 49"
473407[[= include_code('code_samples/api/public_php_api/src/Command/FindByTaxonomyEmbeddingCommand.php') =]]
474408```
@@ -486,10 +420,6 @@ For a list of supported Criteria and Sort Clauses, see [Search in trash referenc
486420
487421 Searching through the trashed content items operates directly on the database, therefore you cannot use external search engines, such as Solr or Elasticsearch, and it's impossible to reindex the data.
488422
489- ``` php
490- [[= include_file('code_samples/api/public_php_api/src/Command/FindInTrashCommand.php', 4, 6) =]]//...
491- [[= include_file('code_samples/api/public_php_api/src/Command/FindInTrashCommand.php', 35, 42) =]]
492- ```
493423``` php
494424[[= include_code('code_samples/api/public_php_api/src/Command/FindInTrashCommand.php', 5, 6) =]]
495425//...
0 commit comments