Description
There are several Atlas Search query operators that are not implemented with first class support in the Java driver. For example, the `phrase` operator. Ideally it could work like this:
Bson search_stage = search(
|
SearchOperator.compound()
|
.filter(Arrays.asList(SearchOperator.text(fieldPath("genres"), "Drama")))
|
.must(Arrays.asList(SearchOperator.phrase(fieldPath("cast"), "keanu reeves")))
|
);
|
Whereas right now, one must know the JSON structure of the operator syntax and use the `.of()` escape hatch like this:
Bson search_stage = search(
|
SearchOperator.compound()
|
.filter(Arrays.asList(SearchOperator.text(fieldPath("genres"), "Drama")))
|
.must(Arrays.asList(SearchOperator.of(new Document("phrase", new Document("query", "keanu reeves").append("path", fieldPath("cast"))))))
|
);
|
https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/