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/11/13 15:20:09 UTC
svn commit: r1639337 - in /lucene/dev/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/compressing/
core/src/java/org/apache/lucene/codecs/lu...
Author: romseygeek
Date: Thu Nov 13 14:20:07 2014
New Revision: 1639337
URL: http://svn.apache.org/r1639337
Log:
Remove default position methods from Scorer
Modified:
lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java
lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java
lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsAndPositionsEnum.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsEnum.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsAndPositionsEnum.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsEnum.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FakeScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/PositionFilteredScorer.java
lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java
lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
Modified: lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java (original)
+++ lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,12 @@ package org.apache.lucene.codecs.memory;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.apache.lucene.codecs.FieldsConsumer;
import org.apache.lucene.codecs.FieldsProducer;
import org.apache.lucene.codecs.PostingsFormat;
@@ -43,12 +49,6 @@ import org.apache.lucene.util.automaton.
import org.apache.lucene.util.automaton.RunAutomaton;
import org.apache.lucene.util.automaton.Transition;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
// TODO:
// - build depth-N prefix hash?
// - or: longer dense skip lists than just next byte?
@@ -1593,6 +1593,31 @@ public final class DirectPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int advance(int target) throws IOException {
// Linear scan, but this is low-freq term so it won't
// be costly:
@@ -1666,6 +1691,31 @@ public final class DirectPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int advance(int target) throws IOException {
// Linear scan, but this is low-freq term so it won't
// be costly:
@@ -1919,6 +1969,31 @@ public final class DirectPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int advance(int target) {
/*
upto++;
@@ -2119,6 +2194,16 @@ public final class DirectPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return curPositions[posUpto];
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return curPositions[posUpto];
+ }
+
+ @Override
public int startOffset() {
if (hasOffsets) {
return curPositions[posUpto+1];
Modified: lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java (original)
+++ lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,13 @@ package org.apache.lucene.codecs.memory;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.FieldsConsumer;
import org.apache.lucene.codecs.FieldsProducer;
@@ -55,13 +62,6 @@ import org.apache.lucene.util.fst.FST;
import org.apache.lucene.util.fst.Util;
import org.apache.lucene.util.packed.PackedInts;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
// TODO: would be nice to somehow allow this to act like
// InstantiatedIndex, by never writing to disk; ie you write
// to this Codec in RAM only and then when you open a reader
@@ -545,6 +545,31 @@ public final class MemoryPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public long cost() {
return numDocs;
}
@@ -699,6 +724,16 @@ public final class MemoryPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
public int startOffset() {
return startOffset;
}
Modified: lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java (original)
+++ lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java Thu Nov 13 14:20:07 2014
@@ -249,6 +249,7 @@ class SimpleTextFieldsReader extends Fie
private boolean omitTF;
private boolean readOffsets;
private boolean readPositions;
+ private int pos;
private int startOffset;
private int endOffset;
private int posPending;
@@ -295,6 +296,7 @@ class SimpleTextFieldsReader extends Fie
in.seek(nextDocStart);
long posStart = 0;
int termFreq = 0;
+ pos = -1;
while(true) {
final long lineStart = in.getFilePointer();
SimpleTextUtil.readLine(in, scratch);
@@ -345,7 +347,6 @@ class SimpleTextFieldsReader extends Fie
@Override
public int nextPosition() throws IOException {
- final int pos;
if (posPending == 0)
return NO_MORE_POSITIONS;
@@ -387,6 +388,16 @@ class SimpleTextFieldsReader extends Fie
}
@Override
+ public int startPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
public int startOffset() throws IOException {
return startOffset;
}
Modified: lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java (original)
+++ lucene/dev/lucene2878/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextTermVectorsReader.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,13 @@ package org.apache.lucene.codecs.simplet
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
import org.apache.lucene.codecs.TermVectorsReader;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.Fields;
@@ -41,13 +48,6 @@ import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.StringHelper;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
import static org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter.DOC;
import static org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter.END;
import static org.apache.lucene.codecs.simpletext.SimpleTextTermVectorsWriter.ENDOFFSET;
@@ -495,6 +495,16 @@ public class SimpleTextTermVectorsReader
}
@Override
+ public int startPosition() throws IOException {
+ return positions[nextPos - 1];
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return positions[nextPos - 1];
+ }
+
+ @Override
public int startOffset() {
if (startOffsets == null) {
return -1;
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingTermVectorsReader.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,12 @@ package org.apache.lucene.codecs.compres
* limitations under the License.
*/
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.TermVectorsReader;
import org.apache.lucene.index.CorruptIndexException;
@@ -44,12 +50,6 @@ import org.apache.lucene.util.LongsRef;
import org.apache.lucene.util.packed.BlockPackedReaderIterator;
import org.apache.lucene.util.packed.PackedInts;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
import static org.apache.lucene.codecs.compressing.CompressingTermVectorsWriter.BLOCK_SIZE;
import static org.apache.lucene.codecs.compressing.CompressingTermVectorsWriter.CODEC_SFX_DAT;
import static org.apache.lucene.codecs.compressing.CompressingTermVectorsWriter.CODEC_SFX_IDX;
@@ -998,6 +998,16 @@ public final class CompressingTermVector
}
@Override
+ public int startPosition() throws IOException {
+ return positions[positionIndex + i];
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return positions[positionIndex + i];
+ }
+
+ @Override
public int startOffset() throws IOException {
checkPosition();
if (startOffsets == null) {
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java Thu Nov 13 14:20:07 2014
@@ -351,6 +351,31 @@ public final class Lucene50PostingsReade
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public int docID() {
return doc;
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java Thu Nov 13 14:20:07 2014
@@ -86,31 +86,22 @@ public abstract class DocsEnum extends D
* when pulling the enum. */
public abstract int nextPosition() throws IOException;
- public int startPosition() throws IOException {
- throw new UnsupportedOperationException("startPosition() is not implemented on " + this.getClass().getSimpleName());
- }
-
- public int endPosition() throws IOException {
- throw new UnsupportedOperationException("endPosition() is not implemented on " + this.getClass().getSimpleName());
- }
+ public abstract int startPosition() throws IOException;
+
+ public abstract int endPosition() throws IOException;
/** Returns start offset for the current position, or -1
* if offsets were not indexed. */
- public int startOffset() throws IOException {
- throw new UnsupportedOperationException("startOffset() is not implemented on " + this.getClass().getSimpleName());
- }
+ public abstract int startOffset() throws IOException;
/** Returns end offset for the current position, or -1 if
* offsets were not indexed. */
- public int endOffset() throws IOException {
- throw new UnsupportedOperationException("endOffset() is not implemented on " + this.getClass().getSimpleName());
- }
+ public abstract int endOffset() throws IOException;
/** Returns the payload at this position, or null if no
* payload was indexed. You should not modify anything
* (neither members of the returned BytesRef nor bytes
* in the byte[]). */
- public BytesRef getPayload() throws IOException {
- return null;
- }
+ public abstract BytesRef getPayload() throws IOException;
+
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java Thu Nov 13 14:20:07 2014
@@ -17,18 +17,18 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.index.FreqProxTermsWriterPerField.FreqProxPostingsArray;
-import org.apache.lucene.util.AttributeSource;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.BytesRefBuilder;
-
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.apache.lucene.index.FreqProxTermsWriterPerField.FreqProxPostingsArray;
+import org.apache.lucene.util.AttributeSource;
+import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.BytesRefBuilder;
+
/** Implements limited (iterators only, no stats) {@link
* Fields} interface over the in-RAM buffered
* fields/terms/postings, to flush postings through the
@@ -353,6 +353,31 @@ class FreqProxFields extends Fields {
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public int nextDoc() throws IOException {
if (reader.eof()) {
if (ended) {
@@ -506,6 +531,16 @@ class FreqProxFields extends Fields {
}
@Override
+ public int startPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
public int startOffset() {
if (!readOffsets) {
throw new IllegalStateException("offsets were not indexed");
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsAndPositionsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsAndPositionsEnum.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsAndPositionsEnum.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsAndPositionsEnum.java Thu Nov 13 14:20:07 2014
@@ -17,11 +17,11 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.index.MultiDocsAndPositionsEnum.EnumWithSlice;
-
import java.io.IOException;
+import org.apache.lucene.index.MultiDocsAndPositionsEnum.EnumWithSlice;
+import org.apache.lucene.util.BytesRef;
+
/**
* Exposes flex API, merged from flex API of sub-segments,
* remapping docIDs (this is used for segment merging).
@@ -122,6 +122,16 @@ final class MappingMultiDocsAndPositions
}
@Override
+ public int startPosition() throws IOException {
+ return current.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return current.endPosition();
+ }
+
+ @Override
public int startOffset() throws IOException {
return current.startOffset();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsEnum.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsEnum.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MappingMultiDocsEnum.java Thu Nov 13 14:20:07 2014
@@ -17,10 +17,11 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.index.MultiDocsEnum.EnumWithSlice;
-
import java.io.IOException;
+import org.apache.lucene.index.MultiDocsEnum.EnumWithSlice;
+import org.apache.lucene.util.BytesRef;
+
/**
* Exposes flex API, merged from flex API of sub-segments,
* remapping docIDs (this is used for segment merging).
@@ -75,6 +76,31 @@ final class MappingMultiDocsEnum extends
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int docID() {
return doc;
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsAndPositionsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsAndPositionsEnum.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsAndPositionsEnum.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsAndPositionsEnum.java Thu Nov 13 14:20:07 2014
@@ -17,11 +17,11 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.util.BytesRef;
-
import java.io.IOException;
import java.util.Arrays;
+import org.apache.lucene.util.BytesRef;
+
/**
* Exposes flex API, merged from flex API of sub-segments.
*
@@ -144,6 +144,16 @@ public final class MultiDocsAndPositions
}
@Override
+ public int startPosition() throws IOException {
+ return current.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return current.endPosition();
+ }
+
+ @Override
public int startOffset() throws IOException {
return current.startOffset();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsEnum.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsEnum.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/index/MultiDocsEnum.java Thu Nov 13 14:20:07 2014
@@ -18,11 +18,11 @@ package org.apache.lucene.index;
*/
-import org.apache.lucene.util.BytesRef;
-
import java.io.IOException;
import java.util.Arrays;
+import org.apache.lucene.util.BytesRef;
+
/**
* Exposes {@link DocsEnum}, merged from {@link DocsEnum}
* API of sub-segments.
@@ -98,6 +98,16 @@ public final class MultiDocsEnum extends
}
@Override
+ public int startPosition() throws IOException {
+ return current.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return current.endPosition();
+ }
+
+ @Override
public int startOffset() throws IOException {
return current.startOffset();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java Thu Nov 13 14:20:07 2014
@@ -17,15 +17,16 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.util.ArrayUtil;
-import org.apache.lucene.util.RamUsageEstimator;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.RamUsageEstimator;
+
/**
* Caches all docs, and optionally also scores, coming from
* a search, and is then able to replay them to another
@@ -79,6 +80,31 @@ public abstract class CachingCollector e
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public final int nextDoc() { throw new UnsupportedOperationException(); }
@Override
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConjunctionScorer.java Thu Nov 13 14:20:07 2014
@@ -17,13 +17,14 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.util.ArrayUtil;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
+import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BytesRef;
+
/** Scorer for conjunctions, sets of queries, all of which are required. */
class ConjunctionScorer extends Scorer {
@@ -180,6 +181,11 @@ class ConjunctionScorer extends Scorer {
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return posQueue.getPayload();
+ }
+
+ @Override
public long cost() {
long sum = 0;
for (int i = 0; i < scorers.length; i++) {
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java Thu Nov 13 14:20:07 2014
@@ -17,18 +17,19 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ToStringUtils;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-
/**
* A query that wraps another query or a filter and simply returns a constant score equal to the
* query boost for every document that matches the filter or query.
@@ -259,12 +260,39 @@ public class ConstantScoreQuery extends
return 1;
}
+ // nocommit maybe split into ConstantFilterScorer and ConstantQueryScorer to make these available?
+
@Override
public int nextPosition() throws IOException {
return -1;
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int advance(int target) throws IOException {
return docIdSetIterator.advance(target);
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/DisjunctionScorer.java Thu Nov 13 14:20:07 2014
@@ -22,6 +22,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Locale;
+import org.apache.lucene.util.BytesRef;
+
/**
* Base class for Scorers that score disjunctions.
*/
@@ -146,6 +148,11 @@ abstract class DisjunctionScorer extends
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return posQueue.getPayload();
+ }
+
+ @Override
public String toString() {
try {
return String.format(Locale.ROOT, "DisjScorer[%s] %d(%d)->%d(%d)", weight.toString(),
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ExactPhraseScorer.java Thu Nov 13 14:20:07 2014
@@ -17,12 +17,13 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Arrays;
+
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.search.PhraseQuery.TermDocsEnumFactory;
import org.apache.lucene.search.similarities.Similarity;
-
-import java.io.IOException;
-import java.util.Arrays;
+import org.apache.lucene.util.BytesRef;
final class ExactPhraseScorer extends Scorer {
private final int endMinus1;
@@ -185,6 +186,11 @@ final class ExactPhraseScorer extends Sc
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return null; // nocommit how to deal with payloads across multiple positions?
+ }
+
+ @Override
public int endPosition() throws IOException {
return startPosition() + chunkStates.length - 1;
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FakeScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FakeScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FakeScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FakeScorer.java Thu Nov 13 14:20:07 2014
@@ -20,6 +20,8 @@ package org.apache.lucene.search;
import java.io.IOException;
import java.util.Collection;
+import org.apache.lucene.util.BytesRef;
+
/** Used by {@link BulkScorer}s that need to pass a {@link
* Scorer} to {@link LeafCollector#setScorer}. */
final class FakeScorer extends Scorer {
@@ -52,6 +54,31 @@ final class FakeScorer extends Scorer {
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException("FakeScorer doesn't support startPosition()");
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException("FakeScorer doesn't support endPosition()");
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException("FakeScorer doesn't support startOffset()");
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException("FakeScorer doesn't support endOffset()");
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException("FakeScorer doesn't support getPayload()");
+ }
+
+ @Override
public int nextDoc() {
throw new UnsupportedOperationException("FakeScorer doesn't support nextDoc()");
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilterScorer.java Thu Nov 13 14:20:07 2014
@@ -17,10 +17,11 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.util.AttributeSource;
-
import java.io.IOException;
+import org.apache.lucene.util.AttributeSource;
+import org.apache.lucene.util.BytesRef;
+
/**
* A {@code FilterScorer} contains another {@code Scorer}, which it
* uses as its basic source of data, possibly transforming the data along the
@@ -38,6 +39,11 @@ abstract class FilterScorer extends Scor
super(in.weight);
this.in = in;
}
+
+ public FilterScorer(Scorer in, Weight weight) {
+ super(weight);
+ this.in = in;
+ }
@Override
public float score() throws IOException {
@@ -75,6 +81,31 @@ abstract class FilterScorer extends Scor
}
@Override
+ public int startPosition() throws IOException {
+ return in.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return in.endPosition();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return in.startOffset();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return in.endOffset();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return in.getPayload();
+ }
+
+ @Override
public AttributeSource attributes() {
return in.attributes();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java Thu Nov 13 14:20:07 2014
@@ -17,17 +17,17 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.ToStringUtils;
-
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.ToStringUtils;
+
/**
* A query that applies a filter to the results of another query.
@@ -159,13 +159,13 @@ public class FilteredQuery extends Query
* than document scoring or if the filter has a linear running time to compute
* the next matching doc like exact geo distances.
*/
- private static final class QueryFirstScorer extends Scorer {
+ private static final class QueryFirstScorer extends FilterScorer {
private final Scorer scorer;
private int scorerDoc = -1;
private final Bits filterBits;
protected QueryFirstScorer(Weight weight, Bits filterBits, Scorer other) {
- super(weight);
+ super(other, weight);
this.scorer = other;
this.filterBits = filterBits;
}
@@ -194,29 +194,12 @@ public class FilteredQuery extends Query
public int docID() {
return scorerDoc;
}
-
- @Override
- public float score() throws IOException {
- return scorer.score();
- }
-
- @Override
- public int freq() throws IOException { return scorer.freq(); }
-
- @Override
- public int nextPosition() throws IOException {
- return scorer.nextPosition();
- }
@Override
public Collection<ChildScorer> getChildren() {
return Collections.singleton(new ChildScorer(scorer, "FILTERED"));
}
- @Override
- public long cost() {
- return scorer.cost();
- }
}
private static class QueryFirstBulkScorer extends BulkScorer {
@@ -259,7 +242,7 @@ public class FilteredQuery extends Query
* jumping past the target document. When both land on the same document, it's
* collected.
*/
- private static final class LeapFrogScorer extends Scorer {
+ private static final class LeapFrogScorer extends FilterScorer {
private final DocIdSetIterator secondary;
private final DocIdSetIterator primary;
private final Scorer scorer;
@@ -267,7 +250,7 @@ public class FilteredQuery extends Query
private int secondaryDoc = -1;
protected LeapFrogScorer(Weight weight, DocIdSetIterator primary, DocIdSetIterator secondary, Scorer scorer) {
- super(weight);
+ super(scorer, weight);
this.primary = primary;
this.secondary = secondary;
this.scorer = scorer;
@@ -307,21 +290,6 @@ public class FilteredQuery extends Query
public final int docID() {
return secondaryDoc;
}
-
- @Override
- public final float score() throws IOException {
- return scorer.score();
- }
-
- @Override
- public final int freq() throws IOException {
- return scorer.freq();
- }
-
- @Override
- public int nextPosition() throws IOException {
- return scorer.nextPosition();
- }
@Override
public final Collection<ChildScorer> getChildren() {
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MatchAllDocsQuery.java Thu Nov 13 14:20:07 2014
@@ -17,15 +17,16 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.index.LeafReaderContext;
+import java.io.IOException;
+import java.util.Set;
+
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term;
import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ToStringUtils;
-import java.io.IOException;
-import java.util.Set;
-
/**
* A query that matches all documents.
*
@@ -78,6 +79,31 @@ public class MatchAllDocsQuery extends Q
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException(); // nocommit
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public int advance(int target) throws IOException {
doc = target-1;
return nextDoc();
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MinShouldMatchSumScorer.java Thu Nov 13 14:20:07 2014
@@ -17,14 +17,15 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.util.ArrayUtil;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
+import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BytesRef;
+
/**
* A Scorer for OR like queries, counterpart of <code>ConjunctionScorer</code>.
* This Scorer implements {@link Scorer#advance(int)} and uses advance() on the given Scorers.
@@ -241,6 +242,31 @@ class MinShouldMatchSumScorer extends Sc
return posQueue.nextPosition();
}
+ @Override
+ public int startPosition() throws IOException {
+ return posQueue.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return posQueue.endPosition();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return posQueue.startOffset();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return posQueue.endOffset();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return posQueue.getPayload();
+ }
+
/**
* Advances to the first match beyond the current whose document number is
* greater than or equal to a given target. <br>
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,18 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
@@ -37,18 +49,6 @@ import org.apache.lucene.util.IntroSorte
import org.apache.lucene.util.PriorityQueue;
import org.apache.lucene.util.ToStringUtils;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-
/**
* MultiPhraseQuery is a generalized version of PhraseQuery, with an added
* method {@link #add(Term[])}.
@@ -485,6 +485,14 @@ class UnionDocsAndPositionsEnum extends
return _array[_index++ * 3];
}
+ final int startPosition() {
+ return _array[(_index - 1) * 3];
+ }
+
+ final int endPosition() {
+ return _array[(_index - 1) * 3];
+ }
+
final int startOffset() {
return _array[(_index - 1) * 3 + 1];
}
@@ -627,6 +635,16 @@ class UnionDocsAndPositionsEnum extends
}
@Override
+ public int startPosition() throws IOException {
+ return _posList.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return _posList.endPosition();
+ }
+
+ @Override
public int startOffset() {
return _posList.startOffset();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/PositionQueue.java Thu Nov 13 14:20:07 2014
@@ -1,11 +1,12 @@
package org.apache.lucene.search;
+import java.io.IOException;
+
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.search.posfilter.Interval;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.PriorityQueue;
-import java.io.IOException;
-
/**
* Copyright (c) 2013 Lemur Consulting Ltd.
* <p/>
@@ -124,4 +125,9 @@ public class PositionQueue extends Prior
return current.offsetEnd;
}
+ public BytesRef getPayload() throws IOException {
+ return top().docsEnum.getPayload();
+ }
+
+
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqExclScorer.java Thu Nov 13 14:20:07 2014
@@ -27,7 +27,7 @@ import java.util.Collections;
* This <code>Scorer</code> implements {@link Scorer#advance(int)},
* and it uses the skipTo() on the given scorers.
*/
-class ReqExclScorer extends Scorer {
+class ReqExclScorer extends FilterScorer {
private Scorer reqScorer;
private DocIdSetIterator exclDisi;
private int doc = -1;
@@ -37,7 +37,7 @@ class ReqExclScorer extends Scorer {
* @param exclDisi indicates exclusion.
*/
public ReqExclScorer(Scorer reqScorer, DocIdSetIterator exclDisi) {
- super(reqScorer.weight);
+ super(reqScorer);
this.reqScorer = reqScorer;
this.exclDisi = exclDisi;
}
@@ -103,36 +103,6 @@ class ReqExclScorer extends Scorer {
public float score() throws IOException {
return reqScorer.score(); // reqScorer may be null when next() or skipTo() already return false
}
-
- @Override
- public int freq() throws IOException {
- return reqScorer.freq();
- }
-
- @Override
- public int nextPosition() throws IOException {
- return reqScorer.nextPosition();
- }
-
- @Override
- public int startPosition() throws IOException {
- return reqScorer.startPosition();
- }
-
- @Override
- public int endPosition() throws IOException {
- return reqScorer.endPosition();
- }
-
- @Override
- public int startOffset() throws IOException {
- return reqScorer.startOffset();
- }
-
- @Override
- public int endOffset() throws IOException {
- return reqScorer.endOffset();
- }
@Override
public Collection<ChildScorer> getChildren() {
@@ -154,8 +124,4 @@ class ReqExclScorer extends Scorer {
return doc = toNonExcluded();
}
- @Override
- public long cost() {
- return reqScorer.cost();
- }
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/ReqOptSumScorer.java Thu Nov 13 14:20:07 2014
@@ -20,6 +20,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import org.apache.lucene.util.BytesRef;
+
/** A Scorer for queries with a required part and an optional part.
* Delays skipTo() on the optional part until a score() is needed.
* <br>
@@ -127,6 +129,11 @@ class ReqOptSumScorer extends Scorer {
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return posQueue.getPayload();
+ }
+
+ @Override
public Collection<ChildScorer> getChildren() {
ArrayList<ChildScorer> children = new ArrayList<>(2);
children.add(new ChildScorer(reqScorer, "MUST"));
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java Thu Nov 13 14:20:07 2014
@@ -17,10 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.similarities.Similarity;
-import org.apache.lucene.util.FixedBitSet;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -29,6 +25,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.similarities.Similarity;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.FixedBitSet;
+
final class SloppyPhraseScorer extends Scorer {
private PhrasePositions min, max;
@@ -587,6 +588,11 @@ final class SloppyPhraseScorer extends S
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return null; // nocommit
+ }
+
+ @Override
public int startPosition() throws IOException {
return startpos;
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/PositionFilteredScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/PositionFilteredScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/PositionFilteredScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/posfilter/PositionFilteredScorer.java Thu Nov 13 14:20:07 2014
@@ -17,10 +17,11 @@ package org.apache.lucene.search.posfilt
* limitations under the License.
*/
+import java.io.IOException;
+
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.similarities.Similarity;
-
-import java.io.IOException;
+import org.apache.lucene.util.BytesRef;
public abstract class PositionFilteredScorer extends Scorer {
@@ -130,6 +131,11 @@ public abstract class PositionFilteredSc
}
@Override
+ public BytesRef getPayload() throws IOException {
+ return null; // nocommit
+ }
+
+ @Override
public long cost() {
return child.cost();
}
Modified: lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/java/org/apache/lucene/search/spans/SpanScorer.java Thu Nov 13 14:20:07 2014
@@ -17,11 +17,12 @@ package org.apache.lucene.search.spans;
* limitations under the License.
*/
+import java.io.IOException;
+
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.similarities.Similarity;
-
-import java.io.IOException;
+import org.apache.lucene.util.BytesRef;
/**
* Public for extension only.
@@ -97,9 +98,36 @@ public class SpanScorer extends Scorer {
return numMatches;
}
+ // nocommit - make SpanScorer work with positions, or just nuke it entirely?
+
@Override
public int nextPosition() throws IOException {
- return -1; // nocommit maybe I can coerce this into working?
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException();
}
/** Returns the intermediate "sloppy freq" adjusted for edit distance
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,12 @@ package org.apache.lucene.index;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Random;
+
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.FieldsConsumer;
@@ -39,12 +45,6 @@ import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.Version;
import org.junit.BeforeClass;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Random;
-
// TODO: test multiple codecs here?
// TODO
@@ -754,6 +754,16 @@ public class TestCodecs extends LuceneTe
}
@Override
+ public int startPosition() throws IOException {
+ return termData.positions[docUpto][posUpto].pos;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return termData.positions[docUpto][posUpto].pos;
+ }
+
+ @Override
public BytesRef getPayload() {
return termData.positions[docUpto][posUpto].payload;
}
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java Thu Nov 13 14:20:07 2014
@@ -17,14 +17,15 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.PriorityQueue;
-import java.io.IOException;
-
/**
* Holds all implementations of classes in the o.a.l.search package as a
* back-compatibility test. It does not run any tests per-se, however if
@@ -220,6 +221,31 @@ final class JustCompileSearch {
}
@Override
+ public int startPosition() throws IOException {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);
+ }
+
+ @Override
public int docID() {
throw new UnsupportedOperationException(UNSUPPORTED_MSG);
}
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java Thu Nov 13 14:20:07 2014
@@ -17,11 +17,12 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+
import org.apache.lucene.index.DocsEnum;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
-import java.io.IOException;
-
public class TestCachingCollector extends LuceneTestCase {
private static final double ONE_BYTE = 1.0 / (1024 * 1024); // 1 byte out of MB
@@ -44,6 +45,31 @@ public class TestCachingCollector extend
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int docID() { return 0; }
@Override
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java Thu Nov 13 14:20:07 2014
@@ -17,13 +17,21 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsEnum;
+import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.index.Term;
@@ -39,14 +47,6 @@ import org.apache.lucene.util.TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
/** tests BooleanScorer2's minShouldMatch */
public class TestMinShouldMatch2 extends LuceneTestCase {
static Directory dir;
@@ -321,6 +321,31 @@ public class TestMinShouldMatch2 extends
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public int docID() {
return currentDoc;
}
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java Thu Nov 13 14:20:07 2014
@@ -17,14 +17,15 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+
+import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.document.Document;
-
-import java.io.IOException;
public class TestPositiveScoresOnlyCollector extends LuceneTestCase {
@@ -48,6 +49,31 @@ public class TestPositiveScoresOnlyColle
return -1;
}
+ @Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
@Override public int docID() { return idx; }
@Override public int nextDoc() {
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestQueryRescorer.java Thu Nov 13 14:20:07 2014
@@ -17,11 +17,16 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Set;
+
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericDocValuesField;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause.Occur;
@@ -31,14 +36,10 @@ import org.apache.lucene.search.spans.Sp
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Bits;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Set;
-
public class TestQueryRescorer extends LuceneTestCase {
private IndexSearcher getSearcher(IndexReader r) {
@@ -464,6 +465,31 @@ public class TestQueryRescorer extends L
}
@Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
+ @Override
public long cost() {
return 1;
}
Modified: lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java (original)
+++ lucene/dev/lucene2878/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java Thu Nov 13 14:20:07 2014
@@ -17,14 +17,15 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import java.io.IOException;
+
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
-import java.io.IOException;
-
public class TestScoreCachingWrappingScorer extends LuceneTestCase {
private static final class SimpleScorer extends Scorer {
@@ -52,6 +53,31 @@ public class TestScoreCachingWrappingSco
return -1;
}
+ @Override
+ public int startPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ return -1;
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ return null;
+ }
+
@Override public int docID() { return doc; }
@Override public int nextDoc() {
Modified: lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java (original)
+++ lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java Thu Nov 13 14:20:07 2014
@@ -17,6 +17,17 @@ package org.apache.lucene.codecs.ramonly
* limitations under the License.
*/
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.FieldsConsumer;
import org.apache.lucene.codecs.FieldsProducer;
@@ -41,17 +52,6 @@ import org.apache.lucene.util.FixedBitSe
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.RamUsageEstimator;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
/** Stores all postings data in RAM, but writes a small
* token (header + single int) to identify which "slot" the
* index is using in RAM HashMap.
@@ -546,6 +546,16 @@ public final class RAMOnlyPostingsFormat
}
@Override
+ public int startPosition() throws IOException {
+ return current.positions[posUpto-1];
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return current.positions[posUpto-1];
+ }
+
+ @Override
public int startOffset() {
return -1;
}
Modified: lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java (original)
+++ lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java Thu Nov 13 14:20:07 2014
@@ -271,7 +271,17 @@ public abstract class BasePostingsFormat
posUpto++;
return pos;
}
-
+
+ @Override
+ public int startPosition() throws IOException {
+ return pos;
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ return pos;
+ }
+
@Override
public int startOffset() {
return startOffset;
Modified: lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java?rev=1639337&r1=1639336&r2=1639337&view=diff
==============================================================================
--- lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java (original)
+++ lucene/dev/lucene2878/lucene/test-framework/src/java/org/apache/lucene/search/AssertingScorer.java Thu Nov 13 14:20:07 2014
@@ -17,8 +17,6 @@ package org.apache.lucene.search;
* limitations under the License.
*/
-import org.apache.lucene.index.AssertingLeafReader;
-
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Collection;
@@ -27,6 +25,9 @@ import java.util.Map;
import java.util.Random;
import java.util.WeakHashMap;
+import org.apache.lucene.index.AssertingLeafReader;
+import org.apache.lucene.util.BytesRef;
+
/** Wraps a Scorer with additional checks */
public class AssertingScorer extends Scorer {
@@ -117,6 +118,36 @@ public class AssertingScorer extends Sco
}
@Override
+ public int startPosition() throws IOException {
+ assert iterating();
+ return in.startPosition();
+ }
+
+ @Override
+ public int endPosition() throws IOException {
+ assert iterating();
+ return in.endPosition();
+ }
+
+ @Override
+ public int startOffset() throws IOException {
+ assert iterating();
+ return in.startOffset();
+ }
+
+ @Override
+ public int endOffset() throws IOException {
+ assert iterating();
+ return in.endOffset();
+ }
+
+ @Override
+ public BytesRef getPayload() throws IOException {
+ assert iterating();
+ return in.getPayload();
+ }
+
+ @Override
public int docID() {
return in.docID();
}