66import java .util .HashMap ;
77import java .util .List ;
88import java .util .Map ;
9+ import java .util .concurrent .ExecutionException ;
910
1011import org .assertj .core .api .Assertions ;
1112import org .assertj .core .api .InstanceOfAssertFactories ;
@@ -258,7 +259,7 @@ public void testFetchObjectsWithFilters() throws IOException {
258259 }
259260
260261 @ Test
261- public void testBm25 () throws IOException {
262+ public void testBm25 () throws IOException , InterruptedException , ExecutionException {
262263 var nsWords = ns ("Words" );
263264
264265 client .collections .create (nsWords ,
@@ -281,4 +282,37 @@ public void testBm25() throws IOException {
281282 .extracting (WeaviateObject ::metadata ).extracting (QueryMetadata ::uuid )
282283 .containsOnly (want .metadata ().uuid ());
283284 }
285+
286+ /**
287+ * Minimal test to verify async functionality works as expected.
288+ * We will extend our testing framework at a later stage to automatically
289+ * test both sync/async clients.
290+ */
291+ @ Test
292+ public void testBm25_async () throws IOException , InterruptedException , ExecutionException {
293+ var nsWords = ns ("Words" );
294+
295+ try (final var async = client .async ()) {
296+ async .collections .create (nsWords ,
297+ collection -> collection
298+ .properties (
299+ Property .text ("relevant" ),
300+ Property .text ("irrelevant" )))
301+ .get ();
302+
303+ var words = async .collections .use (nsWords );
304+
305+ /* notWant */ words .data .insert (Map .of ("relevant" , "elefant" , "irrelevant" , "dollar bill" )).get ();
306+ var want = words .data .insert (Map .of ("relevant" , "a dime a dollar" , "irrelevant" , "euro" )).get ();
307+
308+ var dollarWorlds = words .query .bm25 (
309+ "dollar" ,
310+ bm25 -> bm25 .queryProperties ("relevant" )).get ();
311+
312+ Assertions .assertThat (dollarWorlds .objects ())
313+ .hasSize (1 )
314+ .extracting (WeaviateObject ::metadata ).extracting (QueryMetadata ::uuid )
315+ .containsOnly (want .metadata ().uuid ());
316+ }
317+ }
284318}
0 commit comments