LUCENE-7611: Remove unnecessary Exception wrapping from DocumentValueSourceDictionary

This commit is contained in:
Alan Woodward 2017-01-07 16:06:29 +00:00
parent 8f4fee3ad1
commit 67261d2fb5
1 changed files with 7 additions and 14 deletions

View File

@ -132,27 +132,20 @@ public class DocumentValueSourceDictionary extends DocumentDictionary {
* by the <code>weightsValueSource</code>
* */
@Override
protected long getWeight(Document doc, int docId) {
protected long getWeight(Document doc, int docId) throws IOException {
if (currentWeightValues == null) {
return 0;
}
int subIndex = ReaderUtil.subIndex(docId, starts);
if (subIndex != currentLeafIndex) {
currentLeafIndex = subIndex;
try {
currentWeightValues = weightsValueSource.getValues(leaves.get(currentLeafIndex), null);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
try {
if (currentWeightValues.advanceExact(docId - starts[subIndex]))
return currentWeightValues.longValue();
else
return 0;
} catch (IOException e) {
throw new RuntimeException(e);
currentWeightValues = weightsValueSource.getValues(leaves.get(currentLeafIndex), null);
}
if (currentWeightValues.advanceExact(docId - starts[subIndex]))
return currentWeightValues.longValue();
else
return 0;
}
}