@@ -265,9 +265,7 @@ public ImpactsEnum impacts(FieldInfo fieldInfo, BlockTermState state, int flags)
265265 return new BlockImpactsDocsEnum (fieldInfo , (IntBlockTermState ) state );
266266 }
267267
268- if (indexHasPositions
269- && PostingsEnum .featureRequested (flags , PostingsEnum .POSITIONS )
270- && (indexHasOffsets == false || PostingsEnum .featureRequested (flags , PostingsEnum .OFFSETS ) == false )
268+ if ((indexHasOffsets == false || PostingsEnum .featureRequested (flags , PostingsEnum .OFFSETS ) == false )
271269 && (indexHasPayloads == false || PostingsEnum .featureRequested (flags , PostingsEnum .PAYLOADS ) == false )) {
272270 return new BlockImpactsPostingsEnum (fieldInfo , (IntBlockTermState ) state );
273271 }
@@ -287,8 +285,6 @@ final class BlockDocsEnum extends PostingsEnum {
287285 private ES812SkipReader skipper ;
288286 private boolean skipped ;
289287
290- final IndexInput startDocIn ;
291-
292288 IndexInput docIn ;
293289 final boolean indexHasFreq ;
294290 final boolean indexHasPos ;
@@ -320,8 +316,7 @@ final class BlockDocsEnum extends PostingsEnum {
320316 private boolean isFreqsRead ;
321317 private int singletonDocID ; // docid when there is a single pulsed posting, otherwise -1
322318
323- BlockDocsEnum (FieldInfo fieldInfo ) throws IOException {
324- this .startDocIn = ES812PostingsReader .this .docIn ;
319+ BlockDocsEnum (FieldInfo fieldInfo ) {
325320 this .docIn = null ;
326321 indexHasFreq = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS ) >= 0 ;
327322 indexHasPos = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS ) >= 0 ;
@@ -333,7 +328,7 @@ final class BlockDocsEnum extends PostingsEnum {
333328 }
334329
335330 public boolean canReuse (IndexInput docIn , FieldInfo fieldInfo ) {
336- return docIn == startDocIn
331+ return docIn == ES812PostingsReader . this . docIn
337332 && indexHasFreq == (fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS ) >= 0 )
338333 && indexHasPos == (fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS ) >= 0 )
339334 && indexHasPayloads == fieldInfo .hasPayloads ();
@@ -348,7 +343,7 @@ public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOExcep
348343 if (docFreq > 1 ) {
349344 if (docIn == null ) {
350345 // lazy init
351- docIn = startDocIn .clone ();
346+ docIn = ES812PostingsReader . this . docIn .clone ();
352347 }
353348 docIn .seek (docTermStartFP );
354349 }
@@ -379,22 +374,22 @@ public int freq() throws IOException {
379374 }
380375
381376 @ Override
382- public int nextPosition () throws IOException {
377+ public int nextPosition () {
383378 return -1 ;
384379 }
385380
386381 @ Override
387- public int startOffset () throws IOException {
382+ public int startOffset () {
388383 return -1 ;
389384 }
390385
391386 @ Override
392- public int endOffset () throws IOException {
387+ public int endOffset () {
393388 return -1 ;
394389 }
395390
396391 @ Override
397- public BytesRef getPayload () throws IOException {
392+ public BytesRef getPayload () {
398393 return null ;
399394 }
400395
@@ -604,7 +599,7 @@ final class EverythingEnum extends PostingsEnum {
604599 private boolean needsPayloads ; // true if we actually need payloads
605600 private int singletonDocID ; // docid when there is a single pulsed posting, otherwise -1
606601
607- EverythingEnum (FieldInfo fieldInfo ) throws IOException {
602+ EverythingEnum (FieldInfo fieldInfo ) {
608603 indexHasOffsets = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS ) >= 0 ;
609604 indexHasPayloads = fieldInfo .hasPayloads ();
610605
@@ -690,7 +685,7 @@ public EverythingEnum reset(IntBlockTermState termState, int flags) throws IOExc
690685 }
691686
692687 @ Override
693- public int freq () throws IOException {
688+ public int freq () {
694689 return freq ;
695690 }
696691
@@ -851,16 +846,13 @@ public int advance(int target) throws IOException {
851846
852847 // Now scan:
853848 long doc ;
854- while ( true ) {
849+ do {
855850 doc = docBuffer [docBufferUpto ];
856851 freq = (int ) freqBuffer [docBufferUpto ];
857852 posPendingCount += freq ;
858853 docBufferUpto ++;
859854
860- if (doc >= target ) {
861- break ;
862- }
863- }
855+ } while (doc < target );
864856
865857 position = 0 ;
866858 lastStartOffset = 0 ;
@@ -1163,7 +1155,7 @@ public int advance(int target) throws IOException {
11631155 }
11641156
11651157 @ Override
1166- public int nextPosition () throws IOException {
1158+ public int nextPosition () {
11671159 return -1 ;
11681160 }
11691161
@@ -1223,16 +1215,6 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
12231215 // before reading positions:
12241216 private long posPendingFP ;
12251217
1226- // Where this term's postings start in the .doc file:
1227- private final long docTermStartFP ;
1228-
1229- // Where this term's postings start in the .pos file:
1230- private final long posTermStartFP ;
1231-
1232- // Where this term's payloads/offsets start in the .pay
1233- // file:
1234- private final long payTermStartFP ;
1235-
12361218 // File pointer where the last (vInt encoded) pos delta
12371219 // block is. We need this to know whether to bulk
12381220 // decode vs vInt decode the block:
@@ -1251,9 +1233,13 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
12511233 this .posIn = ES812PostingsReader .this .posIn .clone ();
12521234
12531235 docFreq = termState .docFreq ;
1254- docTermStartFP = termState .docStartFP ;
1255- posTermStartFP = termState .posStartFP ;
1256- payTermStartFP = termState .payStartFP ;
1236+ // Where this term's postings start in the .doc file:
1237+ long docTermStartFP = termState .docStartFP ;
1238+ // Where this term's postings start in the .pos file:
1239+ long posTermStartFP = termState .posStartFP ;
1240+ // Where this term's payloads/offsets start in the .pay
1241+ // file:
1242+ long payTermStartFP = termState .payStartFP ;
12571243 totalTermFreq = termState .totalTermFreq ;
12581244 docIn .seek (docTermStartFP );
12591245 posPendingFP = posTermStartFP ;
@@ -1276,7 +1262,7 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
12761262 }
12771263
12781264 @ Override
1279- public int freq () throws IOException {
1265+ public int freq () {
12801266 return freq ;
12811267 }
12821268
@@ -1523,16 +1509,6 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
15231509 // before reading payloads/offsets:
15241510 private long payPendingFP ;
15251511
1526- // Where this term's postings start in the .doc file:
1527- private final long docTermStartFP ;
1528-
1529- // Where this term's postings start in the .pos file:
1530- private final long posTermStartFP ;
1531-
1532- // Where this term's payloads/offsets start in the .pay
1533- // file:
1534- private final long payTermStartFP ;
1535-
15361512 // File pointer where the last (vInt encoded) pos delta
15371513 // block is. We need this to know whether to bulk
15381514 // decode vs vInt decode the block:
@@ -1593,20 +1569,17 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
15931569 }
15941570
15951571 docFreq = termState .docFreq ;
1596- docTermStartFP = termState .docStartFP ;
1597- posTermStartFP = termState .posStartFP ;
1598- payTermStartFP = termState .payStartFP ;
15991572 totalTermFreq = termState .totalTermFreq ;
1600- docIn .seek (docTermStartFP );
1601- posPendingFP = posTermStartFP ;
1602- payPendingFP = payTermStartFP ;
1573+ docIn .seek (termState . docStartFP );
1574+ posPendingFP = termState . posStartFP ;
1575+ payPendingFP = termState . payStartFP ;
16031576 posPendingCount = 0 ;
16041577 if (termState .totalTermFreq < BLOCK_SIZE ) {
1605- lastPosBlockFP = posTermStartFP ;
1578+ lastPosBlockFP = termState . posStartFP ;
16061579 } else if (termState .totalTermFreq == BLOCK_SIZE ) {
16071580 lastPosBlockFP = -1 ;
16081581 } else {
1609- lastPosBlockFP = posTermStartFP + termState .lastPosBlockOffset ;
1582+ lastPosBlockFP = termState . posStartFP + termState .lastPosBlockOffset ;
16101583 }
16111584
16121585 doc = -1 ;
@@ -1617,7 +1590,13 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
16171590 docBufferUpto = BLOCK_SIZE ;
16181591
16191592 skipper = new ES812ScoreSkipReader (docIn .clone (), MAX_SKIP_LEVELS , indexHasPos , indexHasOffsets , indexHasPayloads );
1620- skipper .init (docTermStartFP + termState .skipOffset , docTermStartFP , posTermStartFP , payTermStartFP , docFreq );
1593+ skipper .init (
1594+ termState .docStartFP + termState .skipOffset ,
1595+ termState .docStartFP ,
1596+ termState .posStartFP ,
1597+ termState .payStartFP ,
1598+ docFreq
1599+ );
16211600
16221601 if (indexHasFreq == false ) {
16231602 for (int i = 0 ; i < ForUtil .BLOCK_SIZE ; ++i ) {
0 commit comments