File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -711,6 +711,27 @@ for a reference of all available operators.
711711 ->fields('title', 'content')
712712 ;
713713
714+ To combine multiple search operators, use the `compound operator <https://www.mongodb.com/docs/atlas/atlas-search/compound/ >`_:
715+
716+ .. code-block :: php
717+
718+ <?php
719+
720+ $builder = $dm->createAggregationBuilder(\Documents\Fruits::class);
721+ $builder
722+ ->compound()
723+ ->must()
724+ ->text()->query('varieties')->path('description')
725+ ->should(minimumShouldMatch: 1)
726+ ->text()->query('Fuji')->path('description')
727+ ->text()->query('Golden Delicious')->path('description')
728+ ;
729+
730+ This aggregation will return `Fruits ` documents from whose `description ` field
731+ contains the word "varieties" (must), and should also contain either "Fuji" or
732+ "Golden Delicious" in the `description ` field (at least one due to
733+ `minimumShouldMatch: 1 `).
734+
714735$set
715736----
716737
You can’t perform that action at this time.
0 commit comments