@@ -339,6 +339,36 @@ static PhraseSearchOperator phrase(final Iterable<? extends SearchPath> paths, f
339
339
.append ("query" , queryIterator .hasNext () ? queries : firstQuery ));
340
340
}
341
341
342
+ /**
343
+ * Returns a {@link SearchOperator} that performs a search using a special characters in the search string that can match any character.
344
+ *
345
+ * @param query The string to search for.
346
+ * @param path The indexed field to be searched.
347
+ * @return The requested {@link SearchOperator}.
348
+ * @mongodb.atlas.manual atlas-search/wildcard/ wildcard operator
349
+ */
350
+ static WildcardSearchOperator wildcard (final String query , final SearchPath path ) {
351
+ return wildcard (singleton (notNull ("query" , query )), singleton (notNull ("path" , path )));
352
+ }
353
+
354
+ /**
355
+ * Returns a {@link SearchOperator} that performs a search using a special characters in the search string that can match any character.
356
+ *
357
+ * @param queries The non-empty strings to search for.
358
+ * @param paths The non-empty index fields to be searched.
359
+ * @return The requested {@link SearchOperator}.
360
+ * @mongodb.atlas.manual atlas-search/wildcard/ wildcard operator
361
+ */
362
+ static WildcardSearchOperator wildcard (final Iterable <String > queries , final Iterable <? extends SearchPath > paths ) {
363
+ Iterator <String > queryIterator = notNull ("queries" , queries ).iterator ();
364
+ isTrueArgument ("queries must not be empty" , queryIterator .hasNext ());
365
+ String firstQuery = queryIterator .next ();
366
+ Iterator <? extends SearchPath > pathIterator = notNull ("paths" , paths ).iterator ();
367
+ isTrueArgument ("paths must not be empty" , pathIterator .hasNext ());
368
+ return new SearchConstructibleBsonElement ("wildcard" , new Document ("query" , queryIterator .hasNext () ? queries : firstQuery )
369
+ .append ("path" , combineToBsonValue (pathIterator , false )));
370
+ }
371
+
342
372
/**
343
373
* Returns a {@link SearchOperator} that performs a search using a regular expression.
344
374
*
0 commit comments