-
-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Feature Request: Add Filtered Search Support to LSMVectorIndex
Description
The LSMVectorIndex class currently uses Bits.ALL (no filter) for all vector searches. This prevents users from efficiently restricting the search space to a specific subset of records (e.g., filtering by user ID or category) during the graph traversal.
While JVector supports passing a Bits object to filter nodes during the search, this capability is not exposed in the LSMVectorIndex API.
Proposed Change
Add a new method to LSMVectorIndex that accepts a Set<RID> (or a generic filter) and maps it to a JVector Bits implementation.
public List<Pair<RID, Float>> findNeighborsFromVector(float[] queryVector, int k, Set<RID> allowedRIDs);Implementation Details
The implementation should:
- Accept a
Set<RID>of allowed records. - Create a custom
Bitsimplementation that checks if a node's RID is contained in the allowed set. - Pass this
Bitsfilter toGraphSearcher.search(...)instead ofBits.ALL.
Example Usage (Java)
LSMVectorIndex index = ...;
float[] vector = ...;
Set<RID> allowed = Set.of(new RID(10, 0), new RID(10, 1));
// Perform search restricted to only the RIDs in 'allowed'
List<Pair<RID, Float>> results = index.findNeighborsFromVector(vector, 10, allowed);Reactions are currently unavailable
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request