79622016

Date: 2025-05-14 17:47:26
Score: 1
Natty:
Report link

I found out my answer and it's extremely simple. There's a method for it specifically in com.mongodb.client.model.search.ShouldCompoundSearchOperator.class

Bson searchStage = Aggregates.search(
     SearchOperator.compound()
        .filter(List.of(filterClause))
        .should(List.of(SearchOperator.of(searchQuery), SearchOperator.of(searchQuery1)))
        .minimumShouldMatch(1),
        searchOptions().option("scoreDetails", true).option("index", "default")
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: mmeach