Skip to content

Apache Lucene open-source search software

LUCENE-7611: Remove unnecessary Exception wrapping from DocumentValueSourceDictionary

Alan Woodward67261d2fb515
diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java
index 2291ac9436d..93569756127 100644
--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java
+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java
@@ -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;
+
}
}