fix(ts-sdk): use textLemmatized for BM25 keyword search on Milvus, OpenSearch, and MongoDB (#6497)
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
This commit is contained in:
co-authored by
kartik-mem0
parent
a58e0586ad
commit
9caffeaa7b
@@ -153,4 +153,26 @@ describe("OpenSearchDB", () => {
|
||||
|
||||
await expect(store.get("missing")).resolves.toBeNull();
|
||||
});
|
||||
|
||||
it("keywordSearch queries lemmatized payload fields", async () => {
|
||||
const client = createClient();
|
||||
const store = await createStore(client);
|
||||
|
||||
await store.keywordSearch("stud french", 5, { user_id: "alice" });
|
||||
|
||||
const searchCall = client.search.mock.calls.find(
|
||||
([arg]: any[]) => arg.index === collectionName,
|
||||
);
|
||||
expect(searchCall).toBeDefined();
|
||||
const should = searchCall![0].body.query.bool.should;
|
||||
expect(should).toContainEqual({
|
||||
match: { "payload.textLemmatized": "stud french" },
|
||||
});
|
||||
expect(should).toContainEqual({
|
||||
match: { "payload.text_lemmatized": "stud french" },
|
||||
});
|
||||
expect(should).toContainEqual({
|
||||
match: { "payload.data": "stud french" },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user