@@ -20,25 +20,28 @@ namespace {
20
20
using ResultPair = std::pair<float , int64_t >;
21
21
}
22
22
DatasetPtr
23
- SortRangeSearchResult (DatasetPtr data_set, int64_t topk, int64_t nq, std::string metric_type) {
23
+ SortRangeSearchResult (DatasetPtr data_set,
24
+ int64_t topk,
25
+ int64_t nq,
26
+ std::string metric_type) {
24
27
/* *
25
- * nq: number of querys ;
26
- * lims: the size of lims is nq + 1, lims[i+1] - lims[i] refers to the size of RangeSearch result querys [i]
27
- * for example, the nq is 5. In the seleted range,
28
+ * nq: number of queries ;
29
+ * lims: the size of lims is nq + 1, lims[i+1] - lims[i] refers to the size of RangeSearch result queries [i]
30
+ * for example, the nq is 5. In the selected range,
28
31
* the size of RangeSearch result for each nq is [1, 2, 3, 4, 5],
29
32
* the lims will be [0, 1, 3, 6, 10, 15];
30
33
* ids: the size of ids is lim[nq],
31
34
* { i(0,0), i(0,1), …, i(0,k0-1),
32
35
* i(1,0), i(1,1), …, i(1,k1-1),
33
36
* …,
34
37
* i(n-1,0), i(n-1,1), …, i(n-1,kn-1)},
35
- * i(0,0), i(0,1), …, i(0,k0-1) means the ids of RangeSearch result querys [0], k0 equals lim[1] - lim[0];
38
+ * i(0,0), i(0,1), …, i(0,k0-1) means the ids of RangeSearch result queries [0], k0 equals lim[1] - lim[0];
36
39
* dist: the size of ids is lim[nq],
37
40
* { d(0,0), d(0,1), …, d(0,k0-1),
38
41
* d(1,0), d(1,1), …, d(1,k1-1),
39
42
* …,
40
43
* d(n-1,0), d(n-1,1), …, d(n-1,kn-1)},
41
- * d(0,0), d(0,1), …, d(0,k0-1) means the distances of RangeSearch result querys [0], k0 equals lim[1] - lim[0];
44
+ * d(0,0), d(0,1), …, d(0,k0-1) means the distances of RangeSearch result queries [0], k0 equals lim[1] - lim[0];
42
45
*/
43
46
auto lims = GetDatasetLims (data_set);
44
47
auto id = GetDatasetIDs (data_set);
@@ -65,11 +68,14 @@ SortRangeSearchResult(DatasetPtr data_set, int64_t topk, int64_t nq, std::string
65
68
* |------------+---------------| max_heap ascending_order
66
69
*
67
70
*/
68
- std::function<bool (const ResultPair&, const ResultPair&)> cmp = std::less<std::pair<float , int64_t >>();
71
+ std::function<bool (const ResultPair&, const ResultPair&)> cmp =
72
+ std::less<std::pair<float , int64_t >>();
69
73
if (IsMetricType (metric_type, knowhere::metric::IP)) {
70
74
cmp = std::greater<std::pair<float , int64_t >>();
71
75
}
72
- std::priority_queue<std::pair<float , int64_t >, std::vector<std::pair<float , int64_t >>, decltype (cmp)>
76
+ std::priority_queue<std::pair<float , int64_t >,
77
+ std::vector<std::pair<float , int64_t >>,
78
+ decltype (cmp)>
73
79
sub_result (cmp);
74
80
75
81
for (int j = lims[i]; j < lims[i + 1 ]; j++) {
@@ -94,7 +100,9 @@ SortRangeSearchResult(DatasetPtr data_set, int64_t topk, int64_t nq, std::string
94
100
}
95
101
96
102
void
97
- CheckRangeSearchParam (float radius, float range_filter, std::string metric_type) {
103
+ CheckRangeSearchParam (float radius,
104
+ float range_filter,
105
+ std::string metric_type) {
98
106
/*
99
107
* IP: 1.0 range_filter radius
100
108
* |------------+---------------| min_heap descending_order
0 commit comments