// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "searchiterator.h" #include "nearest_neighbor_distance_heap.h" #include #include #include #include #include namespace search::tensor { class DistanceCalculator; } namespace search::queryeval { class GlobalFilter; class NearestNeighborIterator : public SearchIterator { public: using ITensorAttribute = search::tensor::ITensorAttribute; using Value = vespalib::eval::Value; struct Params { fef::TermFieldMatchData &tfmd; std::unique_ptr distance_calc; NearestNeighborDistanceHeap &distanceHeap; const GlobalFilter &filter; Params(fef::TermFieldMatchData &tfmd_in, std::unique_ptr distance_calc_in, NearestNeighborDistanceHeap &distanceHeap_in, const GlobalFilter &filter_in) : tfmd(tfmd_in), distance_calc(std::move(distance_calc_in)), distanceHeap(distanceHeap_in), filter(filter_in) {} }; NearestNeighborIterator(Params params_in) : _params(std::move(params_in)) {} static std::unique_ptr create( bool strict, fef::TermFieldMatchData &tfmd, std::unique_ptr distance_calc, NearestNeighborDistanceHeap &distanceHeap, const GlobalFilter &filter); const Params& params() const { return _params; } private: Params _params; }; } // namespace