Skip to content

Commit

Permalink
[fix](index compaction)Skip writing terms with a doc frequency of 0 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
qidaye authored Oct 31, 2024
1 parent 9882657 commit 7cf6cf4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/CLucene/index/IndexWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,17 @@ void IndexWriter::mergeTerms(bool hasProx, IndexVersion indexVersion) {
}

for (int i = 0; i < numDestIndexes; ++i) {
if (dfs[i] == 0) {
if (infoStream != nullptr) {
std::string name = lucene_wcstoutf8string(smallestTerm->text(), smallestTerm->textLength());
std::string field = lucene_wcstoutf8string(smallestTerm->field(), wcslen(smallestTerm->field()));
std::stringstream ss;
ss << "term: " << name << ", field: " << field << ", doc frequency is zero[" << dfs[i] << "], skip it." << "\n";
message(ss.str());
}
// if doc frequency is 0, it means the term is deleted. So we should not write it.
continue;
}
DefaultSkipListWriter *skipListWriter = skipListWriterList[i];
CL_NS(store)::IndexOutput *freqOutput = freqOutputList[i];
CL_NS(store)::IndexOutput *proxOutput = proxOutputList[i];
Expand Down

0 comments on commit 7cf6cf4

Please sign in to comment.