aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-05-12 13:20:20 +0000
committerArne Juul <arnej@verizonmedia.com>2020-05-12 13:20:20 +0000
commit6007048884ea5c222c0ad88862f7cc12992ac336 (patch)
tree3fbf45b3d06892dbbee771f6f60b09bc3a2af331
parent503880f98dae838c24fbb6869840108b73684952 (diff)
no_bitvector -> !has_filter
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.h8
2 files changed, 14 insertions, 14 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
index 18c6f271e7b..07e10271c55 100644
--- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.cpp
@@ -30,7 +30,7 @@ is_compatible(const vespalib::eval::ValueType& lhs,
* Keeps a heap of the K best hit distances.
* Currently always does brute-force scanning, which is very expensive.
**/
-template <bool strict, bool no_bitvector>
+template <bool strict, bool has_filter>
class NearestNeighborImpl : public NearestNeighborIterator
{
public:
@@ -49,7 +49,7 @@ public:
void doSeek(uint32_t docId) override {
double distanceLimit = params().distanceHeap.distanceLimit();
while (__builtin_expect((docId < getEndId()), true)) {
- if (no_bitvector || params().bit_vector->testBit(docId)) {
+ if ((!has_filter) || params().filter->testBit(docId)) {
double d = computeDistance(docId, distanceLimit);
if (d <= distanceLimit) {
_lastScore = d;
@@ -86,12 +86,12 @@ private:
double _lastScore;
};
-template <bool strict, bool no_bitvector>
-NearestNeighborImpl<strict, no_bitvector>::~NearestNeighborImpl() = default;
+template <bool strict, bool has_filter>
+NearestNeighborImpl<strict, has_filter>::~NearestNeighborImpl() = default;
namespace {
-template <bool no_bitvector>
+template <bool has_filter>
std::unique_ptr<NearestNeighborIterator>
resolve_strict(bool strict, const NearestNeighborIterator::Params &params)
{
@@ -99,10 +99,10 @@ resolve_strict(bool strict, const NearestNeighborIterator::Params &params)
CellType rct = params.tensorAttribute.getTensorType().cell_type();
if (lct != rct) abort();
if (strict) {
- using NNI = NearestNeighborImpl<true, no_bitvector>;
+ using NNI = NearestNeighborImpl<true, has_filter>;
return std::make_unique<NNI>(params);
} else {
- using NNI = NearestNeighborImpl<false, no_bitvector>;
+ using NNI = NearestNeighborImpl<false, has_filter>;
return std::make_unique<NNI>(params);
}
}
@@ -116,12 +116,12 @@ NearestNeighborIterator::create(
const vespalib::tensor::DenseTensorView &queryTensor,
const search::tensor::DenseTensorAttribute &tensorAttribute,
NearestNeighborDistanceHeap &distanceHeap,
- const search::BitVector *bit_vector,
+ const search::BitVector *filter,
const search::tensor::DistanceFunction *dist_fun)
{
- Params params(tfmd, queryTensor, tensorAttribute, distanceHeap, bit_vector, dist_fun);
- if (!bit_vector) {
+ Params params(tfmd, queryTensor, tensorAttribute, distanceHeap, filter, dist_fun);
+ if (filter) {
return resolve_strict<true>(strict, params);
} else {
return resolve_strict<false>(strict, params);
diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.h b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.h
index 6b906fb1780..9cbb1d39a91 100644
--- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.h
+++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_iterator.h
@@ -25,20 +25,20 @@ public:
const DenseTensorView &queryTensor;
const DenseTensorAttribute &tensorAttribute;
NearestNeighborDistanceHeap &distanceHeap;
- const search::BitVector *bit_vector;
+ const search::BitVector *filter;
const search::tensor::DistanceFunction *distanceFunction;
Params(fef::TermFieldMatchData &tfmd_in,
const DenseTensorView &queryTensor_in,
const DenseTensorAttribute &tensorAttribute_in,
NearestNeighborDistanceHeap &distanceHeap_in,
- const search::BitVector *bit_vector_in,
+ const search::BitVector *filter_in,
const search::tensor::DistanceFunction *distanceFunction_in)
: tfmd(tfmd_in),
queryTensor(queryTensor_in),
tensorAttribute(tensorAttribute_in),
distanceHeap(distanceHeap_in),
- bit_vector(bit_vector_in),
+ filter(filter_in),
distanceFunction(distanceFunction_in)
{}
};
@@ -53,7 +53,7 @@ public:
const vespalib::tensor::DenseTensorView &queryTensor,
const search::tensor::DenseTensorAttribute &tensorAttribute,
NearestNeighborDistanceHeap &distanceHeap,
- const search::BitVector *bit_vector,
+ const search::BitVector *filter,
const search::tensor::DistanceFunction *dist_fun);
const Params& params() const { return _params; }