From 26dc0dbdf70b6911f979bc01e8a6c824526f0d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 15 Oct 2025 14:00:17 +0200 Subject: [PATCH] Add an example for using the compound search operator --- .../reference/aggregation-stage-reference.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/en/reference/aggregation-stage-reference.rst b/docs/en/reference/aggregation-stage-reference.rst index a5926aec16..7296334bde 100644 --- a/docs/en/reference/aggregation-stage-reference.rst +++ b/docs/en/reference/aggregation-stage-reference.rst @@ -701,6 +701,27 @@ for a reference of all available operators. ->fields('title', 'content') ; +To combine multiple search operators, use the `compound operator `_: + +.. code-block:: php + + createAggregationBuilder(\Documents\Fruits::class); + $builder + ->compound() + ->must() + ->text()->query('varieties')->path('description') + ->should(minimumShouldMatch: 1) + ->text()->query('Fuji')->path('description') + ->text()->query('Golden Delicious')->path('description') + ; + +This aggregation will return `Fruits` documents from whose `description` field +contains the word "varieties" (must), and should also contain either "Fuji" or +"Golden Delicious" in the `description` field (at least one due to +`minimumShouldMatch: 1`). + $set ----