Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Many users request Milvus to realize a "range search" functionality. With this capability, user can

  • filter out get results with distance falling outside of in a range scope
  • get arbitrary TOPK search results , while currently search can return maximum 16384 results.more than 16384

Public Interfaces(optional)

...

We reuse the SDK interface Search() to do "range search". We only need add Add 2 more parameters "radius_low_bound" and "radius_high_bound" into params.

...

Code Block
languagepy
  default_index = {"index_type": "HNSW", "params":{"M": 48, "efConstruction": 500}, "metric_type": "L2"}
  collection.create_index("float_vector", default_index)
  collection.load()  
  search_params = {"metric_type": "L2", "params": {"ef": 32, "radius_low_bound": 1.0, "radius_high_bound": 2.0}}
  res = collection.search(vectors[:nq], "float_vector", search_params, limit, "int64 >= 0")
  • No interface change in knowhere

Knowhere reuses interface Query() for range search.

When "radius_low_bound" and "radius_high_bound" are specified in config, knowhere does range search; otherwise, knowhere does search.


  • Add 3 new interfaces in knowhere
Code Block
languagecpp
  // range search parameter legacy check
  virtual bool
  CheckRangeSearch(Config& cfg, const IndexType type, const IndexMode mode);
  
  // range search
  virtual DatasetPtr
  QueryByRange(const DatasetPtr& dataset, const Config& config, const faiss::BitsetView bitset);

  // brute force range search
  static DatasetPtr
  BruteForce::RangeSearch(const DatasetPtr base_dataset, const DatasetPtr query_
Code Block
languagecpp
  virtual DatasetPtr
  Query(const DatasetPtr& dataset, const Config& config, const faiss::BitsetView bitset);

...