...
Code Block | ||
---|---|---|
| ||
virtual DatasetPtr QueryByRange(const DatasetPtr& dataset, const Config& config, const faiss::BitsetView bitset); |
There is one proposal that not to add new interface QueryByRange(), but reusing interface Query() for range search. Considering the implementation in Knowhere, we don't accept this proposal, because not all types of index support range search.
By now, Knowhere can support 13 types of index, but only 8 of them can support range search (the cell filled with BLUE):
BinaryIDMAP | BinaryIVF | |||
IDMAP | IVF_FLAT | IVF_FLAT_NM | IVF_SQ | IVF_PQ |
HNSW | ANNOY | |||
RHNSW_FLAT | RHNSW_IVF | RHNSW_SQ | RHNSW_PQ |
If add new interface QueryByRange(), we can add following code into "VecIndex.h". If QueryByRange() is called for an index type which does not support range search, a knowhere exception will be thrown out.
Code Block | ||
---|---|---|
| ||
virtual DatasetPtr
QueryByRange(const DatasetPtr& dataset, const Config& config, const faiss::BitsetView bitset) {
KNOWHERE_THROW_MSG("QueryByRange not supported yet");
} |
I we reuse interface Query() for range search, then the implementation of Query() for all index types will be change like this:
Code Block | ||
---|---|---|
| ||
virtual DatasetPtr
Query(const DatasetPtr& dataset, const Config& config, const faiss::BitsetView bitset) {
if (radius exist in config) {
// do range search
} else {
// do query
}
} |
Design Details(required)
Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgment based on the scope of the change.
...