@@ -265,9 +265,7 @@ public ImpactsEnum impacts(FieldInfo fieldInfo, BlockTermState state, int flags)
265
265
return new BlockImpactsDocsEnum (fieldInfo , (IntBlockTermState ) state );
266
266
}
267
267
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 )
271
269
&& (indexHasPayloads == false || PostingsEnum .featureRequested (flags , PostingsEnum .PAYLOADS ) == false )) {
272
270
return new BlockImpactsPostingsEnum (fieldInfo , (IntBlockTermState ) state );
273
271
}
@@ -287,8 +285,6 @@ final class BlockDocsEnum extends PostingsEnum {
287
285
private ES812SkipReader skipper ;
288
286
private boolean skipped ;
289
287
290
- final IndexInput startDocIn ;
291
-
292
288
IndexInput docIn ;
293
289
final boolean indexHasFreq ;
294
290
final boolean indexHasPos ;
@@ -320,8 +316,7 @@ final class BlockDocsEnum extends PostingsEnum {
320
316
private boolean isFreqsRead ;
321
317
private int singletonDocID ; // docid when there is a single pulsed posting, otherwise -1
322
318
323
- BlockDocsEnum (FieldInfo fieldInfo ) throws IOException {
324
- this .startDocIn = ES812PostingsReader .this .docIn ;
319
+ BlockDocsEnum (FieldInfo fieldInfo ) {
325
320
this .docIn = null ;
326
321
indexHasFreq = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS ) >= 0 ;
327
322
indexHasPos = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS ) >= 0 ;
@@ -333,7 +328,7 @@ final class BlockDocsEnum extends PostingsEnum {
333
328
}
334
329
335
330
public boolean canReuse (IndexInput docIn , FieldInfo fieldInfo ) {
336
- return docIn == startDocIn
331
+ return docIn == ES812PostingsReader . this . docIn
337
332
&& indexHasFreq == (fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS ) >= 0 )
338
333
&& indexHasPos == (fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS ) >= 0 )
339
334
&& indexHasPayloads == fieldInfo .hasPayloads ();
@@ -348,7 +343,7 @@ public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOExcep
348
343
if (docFreq > 1 ) {
349
344
if (docIn == null ) {
350
345
// lazy init
351
- docIn = startDocIn .clone ();
346
+ docIn = ES812PostingsReader . this . docIn .clone ();
352
347
}
353
348
docIn .seek (docTermStartFP );
354
349
}
@@ -379,22 +374,22 @@ public int freq() throws IOException {
379
374
}
380
375
381
376
@ Override
382
- public int nextPosition () throws IOException {
377
+ public int nextPosition () {
383
378
return -1 ;
384
379
}
385
380
386
381
@ Override
387
- public int startOffset () throws IOException {
382
+ public int startOffset () {
388
383
return -1 ;
389
384
}
390
385
391
386
@ Override
392
- public int endOffset () throws IOException {
387
+ public int endOffset () {
393
388
return -1 ;
394
389
}
395
390
396
391
@ Override
397
- public BytesRef getPayload () throws IOException {
392
+ public BytesRef getPayload () {
398
393
return null ;
399
394
}
400
395
@@ -604,7 +599,7 @@ final class EverythingEnum extends PostingsEnum {
604
599
private boolean needsPayloads ; // true if we actually need payloads
605
600
private int singletonDocID ; // docid when there is a single pulsed posting, otherwise -1
606
601
607
- EverythingEnum (FieldInfo fieldInfo ) throws IOException {
602
+ EverythingEnum (FieldInfo fieldInfo ) {
608
603
indexHasOffsets = fieldInfo .getIndexOptions ().compareTo (IndexOptions .DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS ) >= 0 ;
609
604
indexHasPayloads = fieldInfo .hasPayloads ();
610
605
@@ -690,7 +685,7 @@ public EverythingEnum reset(IntBlockTermState termState, int flags) throws IOExc
690
685
}
691
686
692
687
@ Override
693
- public int freq () throws IOException {
688
+ public int freq () {
694
689
return freq ;
695
690
}
696
691
@@ -851,16 +846,13 @@ public int advance(int target) throws IOException {
851
846
852
847
// Now scan:
853
848
long doc ;
854
- while ( true ) {
849
+ do {
855
850
doc = docBuffer [docBufferUpto ];
856
851
freq = (int ) freqBuffer [docBufferUpto ];
857
852
posPendingCount += freq ;
858
853
docBufferUpto ++;
859
854
860
- if (doc >= target ) {
861
- break ;
862
- }
863
- }
855
+ } while (doc < target );
864
856
865
857
position = 0 ;
866
858
lastStartOffset = 0 ;
@@ -1010,7 +1002,7 @@ final class BlockImpactsDocsEnum extends ImpactsEnum {
1010
1002
1011
1003
final boolean indexHasFreqs ;
1012
1004
1013
- private int docFreq ; // number of docs in this posting list
1005
+ private final int docFreq ; // number of docs in this posting list
1014
1006
private int blockUpto ; // number of documents in or before the current block
1015
1007
private int doc ; // doc we last read
1016
1008
private long accum ; // accumulator for doc deltas
@@ -1167,7 +1159,7 @@ public int advance(int target) throws IOException {
1167
1159
}
1168
1160
1169
1161
@ Override
1170
- public int nextPosition () throws IOException {
1162
+ public int nextPosition () {
1171
1163
return -1 ;
1172
1164
}
1173
1165
@@ -1211,8 +1203,8 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
1211
1203
final boolean indexHasOffsets ;
1212
1204
final boolean indexHasPayloads ;
1213
1205
1214
- private int docFreq ; // number of docs in this posting list
1215
- private long totalTermFreq ; // number of positions in this posting list
1206
+ private final int docFreq ; // number of docs in this posting list
1207
+ private final long totalTermFreq ; // number of positions in this posting list
1216
1208
private int docUpto ; // how many docs we've read
1217
1209
private int doc ; // doc we last read
1218
1210
private long accum ; // accumulator for doc deltas
@@ -1227,20 +1219,10 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
1227
1219
// before reading positions:
1228
1220
private long posPendingFP ;
1229
1221
1230
- // Where this term's postings start in the .doc file:
1231
- private long docTermStartFP ;
1232
-
1233
- // Where this term's postings start in the .pos file:
1234
- private long posTermStartFP ;
1235
-
1236
- // Where this term's payloads/offsets start in the .pay
1237
- // file:
1238
- private long payTermStartFP ;
1239
-
1240
1222
// File pointer where the last (vInt encoded) pos delta
1241
1223
// block is. We need this to know whether to bulk
1242
1224
// decode vs vInt decode the block:
1243
- private long lastPosBlockFP ;
1225
+ private final long lastPosBlockFP ;
1244
1226
1245
1227
private int nextSkipDoc = -1 ;
1246
1228
@@ -1255,9 +1237,13 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
1255
1237
this .posIn = ES812PostingsReader .this .posIn .clone ();
1256
1238
1257
1239
docFreq = termState .docFreq ;
1258
- docTermStartFP = termState .docStartFP ;
1259
- posTermStartFP = termState .posStartFP ;
1260
- payTermStartFP = termState .payStartFP ;
1240
+ // Where this term's postings start in the .doc file:
1241
+ long docTermStartFP = termState .docStartFP ;
1242
+ // Where this term's postings start in the .pos file:
1243
+ long posTermStartFP = termState .posStartFP ;
1244
+ // Where this term's payloads/offsets start in the .pay
1245
+ // file:
1246
+ long payTermStartFP = termState .payStartFP ;
1261
1247
totalTermFreq = termState .totalTermFreq ;
1262
1248
docIn .seek (docTermStartFP );
1263
1249
posPendingFP = posTermStartFP ;
@@ -1280,7 +1266,7 @@ final class BlockImpactsPostingsEnum extends ImpactsEnum {
1280
1266
}
1281
1267
1282
1268
@ Override
1283
- public int freq () throws IOException {
1269
+ public int freq () {
1284
1270
return freq ;
1285
1271
}
1286
1272
@@ -1507,8 +1493,8 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
1507
1493
final boolean indexHasOffsets ;
1508
1494
final boolean indexHasPayloads ;
1509
1495
1510
- private int docFreq ; // number of docs in this posting list
1511
- private long totalTermFreq ; // number of positions in this posting list
1496
+ private final int docFreq ; // number of docs in this posting list
1497
+ private final long totalTermFreq ; // number of positions in this posting list
1512
1498
private int docUpto ; // how many docs we've read
1513
1499
private int posDocUpTo ; // for how many docs we've read positions, offsets, and payloads
1514
1500
private int doc ; // doc we last read
@@ -1527,20 +1513,10 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
1527
1513
// before reading payloads/offsets:
1528
1514
private long payPendingFP ;
1529
1515
1530
- // Where this term's postings start in the .doc file:
1531
- private long docTermStartFP ;
1532
-
1533
- // Where this term's postings start in the .pos file:
1534
- private long posTermStartFP ;
1535
-
1536
- // Where this term's payloads/offsets start in the .pay
1537
- // file:
1538
- private long payTermStartFP ;
1539
-
1540
1516
// File pointer where the last (vInt encoded) pos delta
1541
1517
// block is. We need this to know whether to bulk
1542
1518
// decode vs vInt decode the block:
1543
- private long lastPosBlockFP ;
1519
+ private final long lastPosBlockFP ;
1544
1520
1545
1521
private int nextSkipDoc = -1 ;
1546
1522
@@ -1597,20 +1573,17 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
1597
1573
}
1598
1574
1599
1575
docFreq = termState .docFreq ;
1600
- docTermStartFP = termState .docStartFP ;
1601
- posTermStartFP = termState .posStartFP ;
1602
- payTermStartFP = termState .payStartFP ;
1603
1576
totalTermFreq = termState .totalTermFreq ;
1604
- docIn .seek (docTermStartFP );
1605
- posPendingFP = posTermStartFP ;
1606
- payPendingFP = payTermStartFP ;
1577
+ docIn .seek (termState . docStartFP );
1578
+ posPendingFP = termState . posStartFP ;
1579
+ payPendingFP = termState . payStartFP ;
1607
1580
posPendingCount = 0 ;
1608
1581
if (termState .totalTermFreq < BLOCK_SIZE ) {
1609
- lastPosBlockFP = posTermStartFP ;
1582
+ lastPosBlockFP = termState . posStartFP ;
1610
1583
} else if (termState .totalTermFreq == BLOCK_SIZE ) {
1611
1584
lastPosBlockFP = -1 ;
1612
1585
} else {
1613
- lastPosBlockFP = posTermStartFP + termState .lastPosBlockOffset ;
1586
+ lastPosBlockFP = termState . posStartFP + termState .lastPosBlockOffset ;
1614
1587
}
1615
1588
1616
1589
doc = -1 ;
@@ -1621,7 +1594,13 @@ final class BlockImpactsEverythingEnum extends ImpactsEnum {
1621
1594
docBufferUpto = BLOCK_SIZE ;
1622
1595
1623
1596
skipper = new ES812ScoreSkipReader (docIn .clone (), MAX_SKIP_LEVELS , indexHasPos , indexHasOffsets , indexHasPayloads );
1624
- skipper .init (docTermStartFP + termState .skipOffset , docTermStartFP , posTermStartFP , payTermStartFP , docFreq );
1597
+ skipper .init (
1598
+ termState .docStartFP + termState .skipOffset ,
1599
+ termState .docStartFP ,
1600
+ termState .posStartFP ,
1601
+ termState .payStartFP ,
1602
+ docFreq
1603
+ );
1625
1604
1626
1605
if (indexHasFreq == false ) {
1627
1606
for (int i = 0 ; i < ForUtil .BLOCK_SIZE ; ++i ) {
0 commit comments