jean-pierreBoth / hnswlib-rs

Rust implementation of the HNSW algorithm (Malkov-Yashunin)
Other
152 stars 22 forks source link

Implementation of filter #6

Closed pegesund closed 1 year ago

pegesund commented 1 year ago

This is code for adding filtering to the hnsw-search.

There is a trait for filterable types, and there is implementation for a sorted vector which contiain ids-which is "allowed". There is also support for doing filtering in closures, where the function simply returns true/false if the entity should be in the result set.

The filtering does not add a noticable speed penalty when there is no filtering and current functionalty has been 100% preserved.

Examples on the filtering functionality in the examples directory.

jean-pierreBoth commented 1 year ago

merged