fix test bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1517372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-08-25 19:29:16 +00:00
parent 13789ae20b
commit 278d690bad
1 changed files with 10 additions and 0 deletions

View File

@ -1092,6 +1092,11 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase {
public void testRandomSortedBytes() throws IOException { public void testRandomSortedBytes() throws IOException {
Directory dir = newDirectory(); Directory dir = newDirectory();
IndexWriterConfig cfg = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); IndexWriterConfig cfg = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
if (!defaultCodecSupportsDocsWithField()) {
// if the codec doesnt support missing, we expect missing to be mapped to byte[]
// by the impersonator, but we have to give it a chance to merge them to this
cfg.setMergePolicy(newLogMergePolicy());
}
RandomIndexWriter w = new RandomIndexWriter(random(), dir, cfg); RandomIndexWriter w = new RandomIndexWriter(random(), dir, cfg);
int numDocs = atLeast(100); int numDocs = atLeast(100);
BytesRefHash hash = new BytesRefHash(); BytesRefHash hash = new BytesRefHash();
@ -1123,6 +1128,11 @@ public abstract class BaseDocValuesFormatTestCase extends LuceneTestCase {
if (rarely()) { if (rarely()) {
w.commit(); w.commit();
} }
if (!defaultCodecSupportsDocsWithField()) {
// if the codec doesnt support missing, we expect missing to be mapped to byte[]
// by the impersonator, but we have to give it a chance to merge them to this
w.forceMerge(1);
}
for (int i = 0; i < numDocs; i++) { for (int i = 0; i < numDocs; i++) {
Document doc = new Document(); Document doc = new Document();
String id = "" + i + numDocs; String id = "" + i + numDocs;