Add NOT operator to VectorStore portable filter expressions
- Add NOT expression type to the portable Filter.Expression model. - Add NOT to the Antlr grammar and implement the related parser listener method to generate Filter NOT expressions. - Add NOT support to the filter programming DSL. - Implement FilterHelper.negation for logically transform any boolean expression with NOT statements into semantically equivalent one with NOT applied to the leaf expressions. - Add tests for paresers, converters and vectorsores ITs. - Move the filter IN/NIN expansion logic to the FilterHelper - Factor out the filter IN/NIN boolean expression expansion logic out of Weaviate up to the FilterHelper. - add in/nin expantion FilterHelper tests
This commit is contained in:
committed by
Mark Pollack
parent
e3e5070256
commit
ac9ae589f4
@@ -182,6 +182,12 @@ public class PgVectorStoreIT {
|
||||
assertThat(results.get(0).getId()).isIn(bgDocument.getId(), nlDocument.getId());
|
||||
assertThat(results.get(1).getId()).isIn(bgDocument.getId(), nlDocument.getId());
|
||||
|
||||
results = vectorStore.similaritySearch(searchRequest
|
||||
.withFilterExpression("NOT((country == 'BG' && year == 2020) || (country == 'NL'))"));
|
||||
|
||||
assertThat(results).hasSize(1);
|
||||
assertThat(results.get(0).getId()).isEqualTo(bgDocument2.getId());
|
||||
|
||||
results = vectorStore.similaritySearch(SearchRequest.query("The World")
|
||||
.withTopK(5)
|
||||
.withSimilarityThresholdAll()
|
||||
|
||||
Reference in New Issue
Block a user