You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2014/12/05 17:46:47 UTC
svn commit: r1643349 - in /lucene/dev/branches/lucene2878/lucene:
codecs/src/java/org/apache/lucene/codecs/memory/
codecs/src/java/org/apache/lucene/codecs/simpletext/
core/src/java/org/apache/lucene/codecs/lucene50/
core/src/java/org/apache/lucene/ind...
Author: romseygeek
Date: Fri Dec 5 16:46:47 2014
New Revision: 1643349
URL: http://svn.apache.org/r1643349
Log:
LUCENE-2878: return NO_MORE_POSITIONS rather than throwing UOE
Modified:
lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java
lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java
lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java
lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java
lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
lucene/dev/branches/lucene2878/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java
lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java
lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java
lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
lucene/dev/branches/lucene2878/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java
Modified: lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java (original)
+++ lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java Fri Dec 5 16:46:47 2014
@@ -1592,32 +1592,33 @@ public final class DirectPostingsFormat
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
@@ -1690,32 +1691,33 @@ public final class DirectPostingsFormat
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
@@ -1804,32 +1806,33 @@ public final class DirectPostingsFormat
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false; // should be using LowFreqDocsAndPositionsEnum
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java (original)
+++ lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java Fri Dec 5 16:46:47 2014
@@ -280,32 +280,33 @@ class SimpleTextFieldsReader extends Fie
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java (original)
+++ lucene/dev/branches/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java Fri Dec 5 16:46:47 2014
@@ -422,32 +422,33 @@ public class SimpleTextTermVectorsReader
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java (original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java Fri Dec 5 16:46:47 2014
@@ -345,32 +345,33 @@ public final class Lucene50PostingsReade
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException("Shouldn't call nextPosition() on BlockDocsEnum");
+ assert false; // shouldn't be calling nextPosition() on this
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java (original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java Fri Dec 5 16:46:47 2014
@@ -78,16 +78,21 @@ public abstract class DocsEnum extends D
return atts;
}
- /** Returns the next position. You should only call this
- * up to {@link DocsEnum#freq()} times else
- * the behavior is not defined. If positions were not
- * indexed this will return -1; this only happens if
- * offsets were indexed and you passed needsOffset=true
- * when pulling the enum. */
+ /**
+ * Returns the next position. If there are no more
+ * positions, this will return DocsEnum.NO_MORE_POSITIONS */
public abstract int nextPosition() throws IOException;
+ /**
+ * @return the current starting position.
+ * @throws IOException
+ */
public abstract int startPosition() throws IOException;
+ /**
+ * @return the current ending position
+ * @throws IOException
+ */
public abstract int endPosition() throws IOException;
/** Returns start offset for the current position, or -1
Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java (original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java Fri Dec 5 16:46:47 2014
@@ -349,32 +349,33 @@ class FreqProxFields extends Fields {
@Override
public int nextPosition() throws IOException {
- return -1;
+ assert false; // should be using FreqProxDocsAndPositionsEnum if you want positions
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java (original)
+++ lucene/dev/branches/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java Fri Dec 5 16:46:47 2014
@@ -75,32 +75,32 @@ public class MatchAllDocsQuery extends Q
@Override
public int nextPosition() throws IOException {
- return -1;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException(); // nocommit
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java (original)
+++ lucene/dev/branches/lucene2878/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java Fri Dec 5 16:46:47 2014
@@ -731,19 +731,19 @@ public class PostingsHighlighter {
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ assert false; return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
- public int startOffset() throws IOException { return NO_MORE_POSITIONS; }
+ public int startOffset() throws IOException { return -1; }
@Override
- public int endOffset() throws IOException { return NO_MORE_POSITIONS; }
+ public int endOffset() throws IOException { return -1; }
@Override
public BytesRef getPayload() throws IOException { return null; }
Modified: lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java (original)
+++ lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java Fri Dec 5 16:46:47 2014
@@ -364,32 +364,32 @@ class TermsIncludingScoreQuery extends Q
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java (original)
+++ lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java Fri Dec 5 16:46:47 2014
@@ -279,32 +279,32 @@ public class ToChildBlockJoinQuery exten
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException(); // nocommit do positions make sense here?
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java (original)
+++ lucene/dev/branches/lucene2878/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java Fri Dec 5 16:46:47 2014
@@ -378,32 +378,32 @@ public class ToParentBlockJoinQuery exte
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException(); // nocommit do positions make sense here?
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java (original)
+++ lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/FunctionQuery.java Fri Dec 5 16:46:47 2014
@@ -180,27 +180,27 @@ public class FunctionQuery extends Query
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
public Explanation explain(int doc) throws IOException {
Modified: lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java (original)
+++ lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/ValueSourceScorer.java Fri Dec 5 16:46:47 2014
@@ -100,27 +100,27 @@ public class ValueSourceScorer extends S
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java (original)
+++ lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java Fri Dec 5 16:46:47 2014
@@ -89,32 +89,32 @@ public class TFValueSource extends TermF
@Override
public int nextPosition() throws IOException {
- return -1;
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public BytesRef getPayload() throws IOException {
- throw new UnsupportedOperationException();
+ return null;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java (original)
+++ lucene/dev/branches/lucene2878/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TermFreqValueSource.java Fri Dec 5 16:46:47 2014
@@ -87,22 +87,22 @@ public class TermFreqValueSource extends
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
Modified: lucene/dev/branches/lucene2878/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2878/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java?rev=1643349&r1=1643348&r2=1643349&view=diff
==============================================================================
--- lucene/dev/branches/lucene2878/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java (original)
+++ lucene/dev/branches/lucene2878/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/SingleDocsEnum.java Fri Dec 5 16:46:47 2014
@@ -74,27 +74,27 @@ class SingleDocsEnum extends DocsEnum {
@Override
public int nextPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int endPosition() throws IOException {
- throw new UnsupportedOperationException();
+ return NO_MORE_POSITIONS;
}
@Override
public int startOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override
public int endOffset() throws IOException {
- throw new UnsupportedOperationException();
+ return -1;
}
@Override