Skip to content

Commit d06dc4c

Browse files
committed
Merge branch 'develop'
2 parents e85977f + a5ca611 commit d06dc4c

File tree

4 files changed

+63
-4
lines changed

4 files changed

+63
-4
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ strum_macros = "0.26.4"
5454
tracing = "0.1"
5555
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
5656

57-
oramacore_lib = "0.4.2"
57+
oramacore_lib = "0.4.3"
5858

5959
# JS
6060
oxc_parser = "0.47.1"

src/tests/fulltext_search.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ use assert_approx_eq::assert_approx_eq;
22
use serde_json::json;
33

44
use crate::collection_manager::sides::read::ReadError;
5+
use crate::tests::utils::extrapolate_ids_from_result;
56
use crate::tests::utils::init_log;
67
use crate::tests::utils::TestContext;
8+
use crate::types::LanguageDTO;
79

810
#[tokio::test(flavor = "multi_thread")]
911
async fn test_fulltext_search_simple() {
@@ -1100,3 +1102,53 @@ async fn test_fulltext_ignore_unknown_property_on_multi_index_collection() {
11001102

11011103
drop(test_context);
11021104
}
1105+
1106+
#[tokio::test(flavor = "multi_thread")]
1107+
async fn test_stopwords() {
1108+
init_log();
1109+
1110+
let test_context = TestContext::new().await;
1111+
1112+
let collection_client = test_context
1113+
.create_collection_with_language(Some(LanguageDTO::Italian))
1114+
.await
1115+
.unwrap();
1116+
1117+
let index_client = collection_client.create_index().await.unwrap();
1118+
1119+
index_client
1120+
.insert_documents(
1121+
json!([
1122+
{
1123+
"id": "1",
1124+
"text": "AI & ChatGPT",
1125+
},
1126+
{
1127+
"id": "2",
1128+
"text": "FD & ChatGPT",
1129+
}
1130+
])
1131+
.try_into()
1132+
.unwrap(),
1133+
)
1134+
.await
1135+
.unwrap();
1136+
1137+
let output = collection_client
1138+
.search(
1139+
json!({
1140+
"term": "AI",
1141+
})
1142+
.try_into()
1143+
.unwrap(),
1144+
)
1145+
.await
1146+
.unwrap();
1147+
1148+
// Only doc 1 is returned
1149+
assert_eq!(output.count, 1);
1150+
let doc_ids = extrapolate_ids_from_result(&output);
1151+
assert_eq!(doc_ids, vec!["1".to_string()]);
1152+
1153+
drop(test_context);
1154+
}

src/tests/utils.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ impl TestContext {
327327
}
328328

329329
pub async fn create_collection(&self) -> Result<TestCollectionClient> {
330+
self.create_collection_with_language(None).await
331+
}
332+
333+
pub async fn create_collection_with_language(
334+
&self,
335+
language: Option<LanguageDTO>,
336+
) -> Result<TestCollectionClient> {
330337
let id = Self::generate_collection_id();
331338
let write_api_key = Self::generate_api_key();
332339
let read_api_key_raw = Self::generate_api_key();
@@ -341,7 +348,7 @@ impl TestContext {
341348
mcp_description: None,
342349
read_api_key: read_api_key_raw,
343350
write_api_key,
344-
language: None,
351+
language,
345352
embeddings_model: Some(Model::BGESmall),
346353
},
347354
)

0 commit comments

Comments
 (0)