You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log::warn!("You are executing the vector search test. This WILL take a while and might lead to timeouts in other tests. You can disable this testcase by not enabling the `experimental-vector-search`-feature and running this ");
1228
+
// enable vector searching and configure an embedder
1229
+
let features = crate::features::ExperimentalFeatures::new(&client)
1230
+
.set_vector_store(true)
1231
+
.update()
1232
+
.await
1233
+
.expect("could not enable the vector store");
1234
+
assert_eq!(features.vector_store,true);
1235
+
let embedder_setting = Embedder::HuggingFace(HuggingFaceEmbedderSettings{
// => an embedding should be able to detect that this is equivalent, but not the regular search
1252
+
let results:SearchResults<Document> = index
1253
+
.search()
1254
+
.with_query("Facebook")
1255
+
.with_hybrid("default",1.0)// entirely rely on semantic searching
1256
+
.execute()
1257
+
.await?;
1258
+
assert_eq!(results.hits.len(),1);
1259
+
assert_eq!(
1260
+
&Document{
1261
+
id:1,
1262
+
value:S("dolor sit amet, consectetur adipiscing elit"),
1263
+
kind:S("text"),
1264
+
number:10,
1265
+
nested:Nested{ child:S("second")},
1266
+
},
1267
+
&results.hits[0].result
1268
+
);
1269
+
let results:SearchResults<Document> = index
1270
+
.search()
1271
+
.with_query("zweite")
1272
+
.with_hybrid("default",0.0)// no semantic searching => no matches
1273
+
.execute()
1274
+
.await?;
1275
+
assert_eq!(results.hits.len(),0);
1276
+
1277
+
// word that has a typo => would have been found via traditional means
1278
+
// if entirely relying on semantic searching, no result is found
1279
+
let results:SearchResults<Document> = index
1280
+
.search()
1281
+
.with_query("lohrem")
1282
+
.with_hybrid("default",1.0)
1283
+
.execute()
1284
+
.await?;
1285
+
assert_eq!(results.hits.len(),0);
1286
+
let results:SearchResults<Document> = index
1287
+
.search()
1288
+
.with_query("lohrem")
1289
+
.with_hybrid("default",0.0)
1290
+
.execute()
1291
+
.await?;
1292
+
assert_eq!(results.hits.len(),1);
1293
+
assert_eq!(
1294
+
&Document{
1295
+
id:0,
1296
+
value:S("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."),
0 commit comments