Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/include/zvec/core/framework/index_document.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,16 @@ class IndexDocumentHeap : public ailego::Heap<IndexDocument> {

//! Insert a document into the heap
void emplace(uint64_t key, float score) {
if (score <= threshold_) {
if (score <= threshold_ &&
(!this->full() || score < this->front().score())) {
ailego::Heap<IndexDocument>::emplace(key, score);
}
}

//! Insert a document into the heap
void emplace(uint64_t key, float score, uint32_t index) {
if (score <= threshold_) {
if (score <= threshold_ &&
(!this->full() || score < this->front().score())) {
ailego::Heap<IndexDocument>::emplace(key, score, index);
}
}
Expand Down