mirror of
https://github.com/twitter/the-algorithm.git
synced 2025-01-02 23:51:53 +01:00
Refactor: avoid magic numbers and hardcoded values
This commit is contained in:
parent
ec83d01dca
commit
54f8db5749
@ -37,14 +37,17 @@ public final class EarlybirdRealtimeIndexSegmentAtomicReader
|
||||
*/
|
||||
EarlybirdRealtimeIndexSegmentAtomicReader(EarlybirdRealtimeIndexSegmentData segmentData) {
|
||||
super(segmentData);
|
||||
|
||||
|
||||
final int initialMaxDocId = Integer.MAX_VALUE;
|
||||
|
||||
this.fields = new InMemoryFields(segmentData.getPerFieldMap(), syncData.getIndexPointers());
|
||||
|
||||
// We cache the highest doc ID and the number of docs, because the reader must return the same
|
||||
// values for its entire lifetime, and the segment will get more tweets over time.
|
||||
// These values could be slightly out of sync with 'fields', because we don't update these
|
||||
// values atomically with the fields.
|
||||
this.maxDocId = segmentData.getDocIDToTweetIDMapper().getPreviousDocID(Integer.MAX_VALUE);
|
||||
int initialMaxDocId = Integer.MAX_VALUE;
|
||||
this.maxDocId = segmentData.getDocIDToTweetIDMapper().getPreviousDocID(initialMaxDocId);
|
||||
this.numDocs = segmentData.getDocIDToTweetIDMapper().getNumDocs();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user