@@ -3412,6 +3412,14 @@ public static Expression geoDistance(String fieldName, GeoPoint location) {
34123412 *
34133413 * <p>This Expression can only be used within a {@code Search} stage.
34143414 *
3415+ * <p>Example:
3416+ *
3417+ * <pre>{@code
3418+ * db.pipeline().collection("restaurants").search(
3419+ * Search.withQuery("waffles").withSort(geoDistance(field("location"), new GeoPoint(37.0, -122.0)).ascending())
3420+ * )
3421+ * }</pre>
3422+ *
34153423 * @param field Specifies the field in the document which contains the first {@link GeoPoint} for
34163424 * distance computation.
34173425 * @param location Compute distance to this {@link GeoPoint}.
@@ -3428,7 +3436,13 @@ public static Expression geoDistance(Field field, GeoPoint location) {
34283436 *
34293437 * <p>This Expression can only be used within a {@code Search} stage.
34303438 *
3431- * @param rquery Define the search query using the search DTS.
3439+ * <p>Example:
3440+ *
3441+ * <pre>{@code
3442+ * db.pipeline().collection("restaurants").search(Search.withQuery(documentMatches("waffles OR pancakes")))
3443+ * }</pre>
3444+ *
3445+ * @param rquery Define the search query using the search DSL.
34323446 * @return A new {@link BooleanExpression} representing the documentMatches operation.
34333447 */
34343448 @ BetaApi
@@ -3441,8 +3455,14 @@ public static BooleanExpression documentMatches(String rquery) {
34413455 *
34423456 * <p>This Expression can only be used within a {@code Search} stage.
34433457 *
3458+ * <p>Example:
3459+ *
3460+ * <pre>{@code
3461+ * db.pipeline().collection("restaurants").search(Search.withQuery(matches("menu", "waffles")))
3462+ * }</pre>
3463+ *
34443464 * @param fieldName Perform search on this field.
3445- * @param rquery Define the search query using the rquery DTS .
3465+ * @param rquery Define the search query using the search DSL .
34463466 */
34473467 @ InternalApi
34483468 static BooleanExpression matches (String fieldName , String rquery ) {
@@ -3455,7 +3475,7 @@ static BooleanExpression matches(String fieldName, String rquery) {
34553475 * <p>This Expression can only be used within a {@code Search} stage.
34563476 *
34573477 * @param field Perform search on this field.
3458- * @param rquery Define the search query using the rquery DTS .
3478+ * @param rquery Define the search query using the search DSL .
34593479 */
34603480 @ InternalApi
34613481 static BooleanExpression matches (Field field , String rquery ) {
@@ -3464,10 +3484,18 @@ static BooleanExpression matches(Field field, String rquery) {
34643484
34653485 /**
34663486 * Evaluates to the search score that reflects the topicality of the document to all of the text
3467- * predicates ({@code matches} and {@code documentMatches}) in the search query.
3487+ * predicates (for example: {@code documentMatches}) in the search query.
34683488 *
34693489 * <p>This Expression can only be used within a {@code Search} stage.
34703490 *
3491+ * <p>Example:
3492+ *
3493+ * <pre>{@code
3494+ * db.pipeline().collection("restaurants").search(
3495+ * Search.withQuery("waffles").withSort(score().descending())
3496+ * )
3497+ * }</pre>
3498+ *
34713499 * @return A new {@link Expression} representing the score operation.
34723500 */
34733501 @ BetaApi
@@ -3481,8 +3509,16 @@ public static Expression score() {
34813509 *
34823510 * <p>This Expression can only be used within a {@code Search} stage.
34833511 *
3512+ * <p>Example:
3513+ *
3514+ * <pre>{@code
3515+ * db.pipeline().collection("restaurants").search(
3516+ * Search.withQuery("waffles").withAddFields(snippet("menu", "waffles").as("snippet"))
3517+ * )
3518+ * }</pre>
3519+ *
34843520 * @param fieldName Search the specified field for matching terms.
3485- * @param rquery Define the search query using the search DTS .
3521+ * @param rquery Define the search query using the search DSL .
34863522 * @return A new {@link Expression} representing the snippet operation.
34873523 */
34883524 @ BetaApi
@@ -3497,7 +3533,15 @@ public static Expression snippet(String fieldName, String rquery) {
34973533 *
34983534 * <p>This Expression can only be used within a {@code Search} stage.
34993535 *
3500- * @param rquery Define the search query using the search DTS.
3536+ * <p>Example:
3537+ *
3538+ * <pre>{@code
3539+ * db.pipeline().collection("restaurants").search(
3540+ * Search.withQuery("waffles").withAddFields(field("menu").snippet("waffles").as("snippet"))
3541+ * )
3542+ * }</pre>
3543+ *
3544+ * @param rquery Define the search query using the search DSL.
35013545 * @return A new {@link Expression} representing the snippet operation.
35023546 */
35033547 @ BetaApi
0 commit comments