Versions Compared

Key

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

...

There is another MEP 34 -- IDMAP/BinaryIDMAP Enhancement describing this proposal.

Result Handling

...

Several data structure related with query result need be enhanced to support range search.

  • SubSearchResult

It is used to store

...

each chunk's query result in

...

a segment. 

Need add a new field "lims_" and a new method "merge_range()". Because the behavior of merge between Query() and QueryByRange()

...

differs a lot. For Query(), after

...

merging two "nq * topk" results, we still get

...

"nq * topk" result.

...

But for QueryByRange(), when merge A (with "n0" results

...

) and B (with "n1" results), we get "n0 + n1" results

...

.

Code Block
languagecpp
//=================================================================================================
class SubSearchResult {
    ... ...
    void
    merge(const SubSearchResult& sub_result);

    void
    merge_range(const SubSearchResult& sub_result);					// <==== new added

 private:
    ... ...
    std::vector<int64_t> seg_offsets_;
    std::vector<float> distances_;
    std::vector<size_t> lims_;			// <==== new added

//=================================================================================================
}
  • SearchResult

It is used to store the final result of one segment search. we need add a new field "lims".

Code Block
languagecpp
struct SearchResult {
    ... ...
 public:
    ... ...
    std::vector<float> distances_;
    std::vector<int64_t> seg_offsets_;
    std::vector<size_t> lims_;			// <==== new added
    ... ...
};

在 Query node 中还需要实现多个 segment 之间的 reduce_range();

在 Proxy 中还需要实现多个 SearchResult 之间的 reduce_range();

  • ReduceHelper

It's used to store the final result for all segments in a query node.



Need discuss the interface between Pagination and range search.关于输出结果的处理,需要和 Pagination 的具体实现方案一起讨论。


Compatibility, Deprecation, and Migration Plan(optional)

...