(index journal; minor) Clean up

This commit is contained in:
Viktor Lofgren 2023-09-01 11:32:24 +02:00
parent 10a74f45ea
commit 8c0ce4fc1d

View File

@ -109,7 +109,7 @@ public class IndexConstructorMain {
heartbeat, heartbeat,
IndexJournalReader::singleFile, IndexJournalReader::singleFile,
indexStaging.asPath(), indexStaging.asPath(),
this::addRank, this::addRankToIdEncoding,
tmpDir, tmpDir,
outputFileDocs, outputFileDocs,
outputFileWords); outputFileWords);
@ -135,7 +135,8 @@ public class IndexConstructorMain {
(path) -> IndexJournalReader (path) -> IndexJournalReader
.singleFile(path) .singleFile(path)
.filtering(wordMetaFilter), .filtering(wordMetaFilter),
indexStaging.asPath(), this::addRank, tmpDir, outputFileDocs, outputFileWords); indexStaging.asPath(),
this::addRankToIdEncoding, tmpDir, outputFileDocs, outputFileWords);
} }
private static LongPredicate getPriorityIndexWordMetaFilter() { private static LongPredicate getPriorityIndexWordMetaFilter() {
@ -171,12 +172,16 @@ public class IndexConstructorMain {
converter.convert(); converter.convert();
} }
private long addRank(long docId) { /** Append the domain's ranking to the high bits of a document ID
float rank = domainRankings.getSortRanking(docId); * to ensure they're sorted in order of rank within the index.
return UrlIdCodec.addRank(rank, docId); */
private long addRankToIdEncoding(long docId) {
return UrlIdCodec.addRank(
domainRankings.getSortRanking(docId),
docId);
} }
private class CreateIndexInstructions { private static class CreateIndexInstructions {
public final IndexName name; public final IndexName name;
private final MqSingleShotInbox inbox; private final MqSingleShotInbox inbox;