Skip to content

Apache Lucene open-source search software

merge trunk up to r1670923

Robert Muir5ea36eb99247
diff --cc lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index 5155c325ab3,9c0f540b35b..09898991124
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@@ -1398,13 -1596,16 +1587,16 @@@ public class CheckIndex implements Clos
if (termsEnum.seekCeil(seekTerms[i]) != TermsEnum.SeekStatus.FOUND) {
throw new RuntimeException("seek to existing term " + seekTerms[i] + " failed");
}
+ if (termsEnum.term().equals(seekTerms[i]) == false) {
+ throw new RuntimeException("seek to existing term " + seekTerms[i] + " returned FOUND but seeked to the wrong term " + termsEnum.term());
+ }
- docs = termsEnum.postings(liveDocs, docs, PostingsEnum.NONE);
- if (docs == null) {
+ postings = termsEnum.postings(liveDocs, postings, PostingsEnum.NONE);
+ if (postings == null) {
throw new RuntimeException("null DocsEnum from to existing term " + seekTerms[i]);
}
-
- while(docs.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
+
+ while (postings.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
totDocCount++;
}
}
diff --cc lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
index 2faeee473d2,c7dab682636..acc8a0038ff
--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java
@@@ -17,39 -17,15 +17,26 @@@ package org.apache.lucene.index
* limitations under the License.
*/
+import static org.apache.lucene.index.PostingsEnum.ALL;
+import static org.apache.lucene.index.PostingsEnum.FREQS;
+import static org.apache.lucene.index.PostingsEnum.NONE;
+import static org.apache.lucene.index.PostingsEnum.OFFSETS;
+import static org.apache.lucene.index.PostingsEnum.PAYLOADS;
+import static org.apache.lucene.index.PostingsEnum.POSITIONS;
+
import java.io.IOException;
import java.nio.file.Path;
- import java.util.ArrayList;
- import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.List;
import java.util.Map;
- import java.util.NoSuchElementException;
- import java.util.Random;
- import java.util.Set;
- import java.util.SortedMap;
- import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.MockAnalyzer;
+import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.Token;
- import org.apache.lucene.analysis.Analyzer.TokenStreamComponents;
- import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.FieldsConsumer;
import org.apache.lucene.codecs.FieldsProducer;
import org.apache.lucene.codecs.PostingsFormat;
@@@ -58,16 -34,10 +45,13 @@@ import org.apache.lucene.codecs.perfiel
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.TermsEnum.SeekStatus;
+import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
- import org.apache.lucene.store.FlushInfo;
import org.apache.lucene.store.IOContext;
- import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
- import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LineFileDocs;
import org.apache.lucene.util.RamUsageTester;