mirror of https://github.com/apache/lucene.git
LUCENE-6271: fix nocommits in term vectors tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a1eebea5a2
commit
07c20804b1
|
@ -292,8 +292,7 @@ public class TestTermVectorsReader extends LuceneTestCase {
|
|||
//System.out.println("Term: " + term);
|
||||
assertEquals(testTerms[i], term);
|
||||
assertNotNull(termsEnum.postings(null, null));
|
||||
// nocommit: check
|
||||
assertNull(termsEnum.postings(null, null, PostingsEnum.ALL)); // no pos
|
||||
assertNotNull(termsEnum.postings(null, null, PostingsEnum.ALL));
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
|
|
@ -453,15 +453,12 @@ public abstract class BaseTermVectorsFormatTestCase extends BaseIndexFileFormatT
|
|||
|
||||
bits.clear(0);
|
||||
PostingsEnum docsAndPositionsEnum = termsEnum.postings(bits, random().nextBoolean() ? null : this.docsEnum.get(), PostingsEnum.POSITIONS);
|
||||
assertEquals(ft.storeTermVectorOffsets() || ft.storeTermVectorPositions(), docsAndPositionsEnum != null);
|
||||
// nocommit: check
|
||||
if (docsAndPositionsEnum != null) {
|
||||
if (terms.hasPositions()) {
|
||||
assertEquals(PostingsEnum.NO_MORE_DOCS, docsAndPositionsEnum.nextDoc());
|
||||
}
|
||||
bits.set(0);
|
||||
|
||||
docsAndPositionsEnum = termsEnum.postings(random().nextBoolean() ? bits : null, random().nextBoolean() ? null : docsAndPositionsEnum, PostingsEnum.POSITIONS);
|
||||
assertEquals(ft.storeTermVectorOffsets() || ft.storeTermVectorPositions(), docsAndPositionsEnum != null);
|
||||
if (terms.hasPositions() || terms.hasOffsets()) {
|
||||
assertEquals(0, docsAndPositionsEnum.nextDoc());
|
||||
final int freq = docsAndPositionsEnum.freq();
|
||||
|
|
|
@ -1087,9 +1087,10 @@ public final class TestUtil {
|
|||
return docs(random, termsEnum, liveDocs, reuse, flags);
|
||||
}
|
||||
|
||||
// Returns a DocsEnum from a positioned TermsEnum, but
|
||||
// randomly sometimes uses a DocsAndFreqsEnum, DocsAndPositionsEnum.
|
||||
// Returns a PostingsEnum with random features available
|
||||
public static PostingsEnum docs(Random random, TermsEnum termsEnum, Bits liveDocs, PostingsEnum reuse, int flags) throws IOException {
|
||||
// TODO: simplify this method? it would be easier to randomly either use the flags passed, or do the random selection,
|
||||
// FREQS should be part fo the random selection instead of outside on its own?
|
||||
if (random.nextBoolean()) {
|
||||
if (random.nextBoolean()) {
|
||||
final int posFlags;
|
||||
|
@ -1099,11 +1100,7 @@ public final class TestUtil {
|
|||
case 2: posFlags = PostingsEnum.PAYLOADS; break;
|
||||
default: posFlags = PostingsEnum.ALL; break;
|
||||
}
|
||||
PostingsEnum docsAndPositions = termsEnum.postings(liveDocs, null, posFlags);
|
||||
// nocommit: check
|
||||
if (docsAndPositions != null) {
|
||||
return docsAndPositions;
|
||||
}
|
||||
return termsEnum.postings(liveDocs, null, posFlags);
|
||||
}
|
||||
flags |= PostingsEnum.FREQS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue