Skip to content

Commit

Permalink
Adds integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Sep 4, 2024
1 parent d21dd6f commit 45cd6e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/langchain-community/src/vectorstores/elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,11 @@ export class ElasticVectorSearch extends VectorStore {
},
});
} else if (condition.operator === "exclude") {
const toExclude = { [metadataField]: condition.value }
const toExclude = { [metadataField]: condition.value };
must_not.push({
...(Array.isArray(condition.value) ? { terms: toExclude } : { term: toExclude })
...(Array.isArray(condition.value)
? { terms: toExclude }
: { term: toExclude }),
});
} else if (condition.operator === "or") {
should.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ describe("ElasticVectorSearch", () => {
},
]);
expect(results2).toHaveLength(1);
const results3 = await store.similaritySearch("*", 11, [
{
field: "a",
value: [createdAt],
operator: "exclude",
},
]);
expect(results3).toHaveLength(1);
});

test.skip("ElasticVectorSearch integration with text splitting metadata", async () => {
Expand Down

0 comments on commit 45cd6e4

Please sign in to comment.