Skip to content

Commit

Permalink
Define virtual destructor for IndexScorer
Browse files Browse the repository at this point in the history
It must be defined in order for any `std::unique_ptr<IndexScorer>` to
execute the correct deleter when it goes out of scope. Because we define
the constructor, we also define the copy/move constructor/operator, and
in turn also default constructor, which we need.

Signed-off-by: Michal Siedlaczek <[email protected]>
  • Loading branch information
elshize committed Dec 10, 2024
1 parent 793c7a1 commit 9120bd8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/pisa/scorer/index_scorer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ using TermScorer = std::function<float(uint32_t, uint32_t)>;
/** Index scorer construct scorers for terms in the index. */
class IndexScorer {
public:
IndexScorer() = default;
IndexScorer(const IndexScorer&) = default;
IndexScorer(IndexScorer&&) noexcept = default;
IndexScorer& operator=(const IndexScorer&) = delete;
IndexScorer& operator=(IndexScorer&&) noexcept = delete;
virtual ~IndexScorer() = default;
virtual TermScorer term_scorer(std::uint64_t term_id) const = 0;
};

/** Index scorer using WAND metadata for scoring. */
template <typename Wand>
struct WandIndexScorer: IndexScorer {
struct WandIndexScorer: public IndexScorer {
protected:
const Wand& m_wdata;

Expand Down

0 comments on commit 9120bd8

Please sign in to comment.