Skip to content

VSIM support filter with post processing#1530

Closed
hailangx wants to merge 345 commits intovectorApiPoC-storeV2from
users/haixu/post-filter
Closed

VSIM support filter with post processing#1530
hailangx wants to merge 345 commits intovectorApiPoC-storeV2from
users/haixu/post-filter

Conversation

@hailangx
Copy link
Copy Markdown
Member

@hailangx hailangx commented Feb 2, 2026

This pull request adds support for post-filtering of vector search results using flexible filter expressions evaluated against JSON attributes. The main changes introduce a tokenizer, parser, and evaluator for filter expressions, and integrate post-filtering into the vector search pipeline.

Vector filter expression engine:

  • Introduced a tokenizer (VectorFilterTokenizer.cs) that converts filter strings into tokens, supporting numbers, strings, booleans, identifiers, operators, keywords, and delimiters.
  • Added a parser (VectorFilterParser.cs) that builds an expression tree from tokens, supporting arithmetic, comparison, logical, containment (in), and grouping operators.
  • Implemented an evaluator (VectorFilterEvaluator.cs) that evaluates parsed expression trees against JSON attribute data, handling type conversions, logical operations, and containment checks.
  • Defined expression tree node types (VectorFilterExpression.cs) for literals, member access, unary, and binary operations.

Integration into vector search pipeline:

  • Integrated post-filtering into the vector search flow in VectorManager.cs, applying the filter expression to each result's attributes and updating the result set accordingly. [1] [2] [3]
  • Ensured that post-filtering is only applied when a filter is specified and attributes are included in the results. [1] [2]

These changes enable expressive filtering of vector search results based on complex conditions over JSON attributes.

…rrent directory is / which does not play nice with this path style; instead base on location of assemblies if initial lookup fails
darrenge and others added 14 commits January 28, 2026 14:20
…Allure part of the website is wiped out until next nightly is ran. This fix keeps Allure site untouched when BDN is ran (#1517)
* replace net9 with net10 in project files

* Update net9.0 to net10.0 in ci and nightly

* Updated BDN to run net10 instead of net90 the website is not done yet.

* Updating BDNs to not use .net9.0. Unfortunately, .net10 is not supported in current BDNs.

* Updated External Release to release 8.0 and 10.0 only (no 9.0)

* fix

* Enabled Win10 for BDN since recent fix

* Updated a couple BDNs expected values that were a bit out of range

* Updated .net9.0 for CodeQL

---------

Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
* Bugfix in SortedSetObject

* Fixed in HashObject as well
@hailangx hailangx requested a review from Copilot February 2, 2026 22:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a comprehensive post-filtering capability for vector search results based on flexible filter expressions evaluated against JSON attributes. The implementation adds a complete expression engine that can tokenize, parse, and evaluate complex filter conditions.

Changes:

  • Adds a tokenizer, parser, and evaluator for filter expressions supporting arithmetic, comparison, logical, and containment operators
  • Integrates post-filtering into the vector search pipeline in VectorManager.cs
  • Adds comprehensive test coverage for both basic and advanced filtering scenarios

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Garnet.test/RespVectorSetTests.cs Adds two comprehensive test methods covering basic attribute filtering and advanced filtering with complex expressions
libs/server/Resp/Vector/VectorManager.cs Integrates post-filtering into vector search methods and implements filter evaluation logic
libs/server/Resp/Vector/VectorFilterTokenizer.cs Implements tokenization of filter strings into tokens for parsing
libs/server/Resp/Vector/VectorFilterParser.cs Implements recursive descent parser to build expression trees from tokens
libs/server/Resp/Vector/VectorFilterExpression.cs Defines expression tree node types for representing filter expressions
libs/server/Resp/Vector/VectorFilterEvaluator.cs Implements expression evaluation against JSON attribute data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/server/Resp/Vector/VectorFilterTokenizer.cs Outdated
if (left == null || right == null) return false;

if (left is double || right is double)
return Math.Abs(ToNumber(left) - ToNumber(right)) < 0.0001;
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hard-coded epsilon value of 0.0001 for floating-point comparison should be extracted as a named constant (e.g., private const double ComparisonEpsilon = 0.0001;) to improve maintainability and make the tolerance value explicit and adjustable.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment thread libs/server/Resp/Vector/VectorManager.cs Outdated
hailangx and others added 2 commits February 4, 2026 14:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

@hailangx I've opened a new pull request, #1537, to work on those changes. Once the pull request is ready, I'll request review from you.

@hailangx hailangx marked this pull request as ready for review February 4, 2026 22:29
Base automatically changed from vectorApiPoC to main February 6, 2026 21:50
@hailangx hailangx changed the base branch from main to vectorApiPoC-storeV2 February 10, 2026 00:56
@hailangx hailangx changed the base branch from vectorApiPoC-storeV2 to vectorApi-storev1 February 10, 2026 00:57
@hailangx hailangx changed the base branch from vectorApi-storev1 to vectorApiPoC-storeV2 February 10, 2026 10:32
@hailangx hailangx closed this Feb 20, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.