You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/01/09 16:10:10 UTC

[20/34] lucene-solr:jira/solr-9856: LUCENE-7611: Remove unnecessary Exception wrapping from DocumentValueSourceDictionary

LUCENE-7611: Remove unnecessary Exception wrapping from DocumentValueSourceDictionary


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/67261d2f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/67261d2f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/67261d2f

Branch: refs/heads/jira/solr-9856
Commit: 67261d2fb515f255e05c138281ab6c6b71d66716
Parents: 8f4fee3
Author: Alan Woodward <ro...@apache.org>
Authored: Sat Jan 7 16:06:29 2017 +0000
Committer: Alan Woodward <ro...@apache.org>
Committed: Sat Jan 7 16:06:29 2017 +0000

----------------------------------------------------------------------
 .../suggest/DocumentValueSourceDictionary.java  | 21 +++++++-------------
 1 file changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/67261d2f/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java
----------------------------------------------------------------------
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 2291ac9..9356975 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;
+
     }
 
   }