Skip to content

Commit

Permalink
Use variable-length integers for docFreq and totalTermFreq.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Jan 26, 2024
1 parent 7f66fa7 commit f5367a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public void write(Fields fields, NormsProducer norms) throws IOException {
writer.write(pe, postingsOut);
termsOut.writeVInt(term.length);
termsOut.writeBytes(term.bytes, term.offset, term.length);
termsOut.writeInt(writer.docFreq);
termsOut.writeVInt(writer.docFreq);
if (hasFreqs) {
termsOut.writeLong(writer.totalTermFreq);
termsOut.writeVLong(writer.totalTermFreq);
}
if (hasPositions) {
termsOut.writeLong(proxOffset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,10 @@ private void scanNextTermInCurrentFrame() throws IOException {
assert loadedFrameIndex == state.blockIndex : loadedFrameIndex + " != " + state.blockIndex;
term.setLength(termsReader.readVInt());
termsReader.readBytes(term.bytes(), 0, term.length());
state.docFreq = termsReader.readInt();
state.docFreq = termsReader.readVInt();

if (meta.options.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0) {
state.totalTermFreq = termsReader.readLong();
state.totalTermFreq = termsReader.readVLong();
} else {
state.totalTermFreq = state.docFreq;
}
Expand Down

0 comments on commit f5367a2

Please sign in to comment.