mirror of https://github.com/apache/lucene.git
limit max token length when using LineFileDocs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1617182 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6254a72b5c
commit
0e58bcc3b3
|
@ -118,13 +118,15 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
|
|||
|
||||
public void testFlushDocCount() throws IOException, InterruptedException {
|
||||
int[] numThreads = new int[] { 2 + atLeast(1), 1 };
|
||||
MockAnalyzer analyzer = new MockAnalyzer(random());
|
||||
analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
|
||||
for (int i = 0; i < numThreads.length; i++) {
|
||||
|
||||
final int numDocumentsToIndex = 50 + atLeast(30);
|
||||
AtomicInteger numDocs = new AtomicInteger(numDocumentsToIndex);
|
||||
Directory dir = newDirectory();
|
||||
MockDefaultFlushPolicy flushPolicy = new MockDefaultFlushPolicy();
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()))
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(analyzer)
|
||||
.setFlushPolicy(flushPolicy);
|
||||
|
||||
final int numDWPT = 1 + atLeast(2);
|
||||
|
@ -173,7 +175,9 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
|
|||
final int numDocumentsToIndex = 50 + atLeast(70);
|
||||
AtomicInteger numDocs = new AtomicInteger(numDocumentsToIndex);
|
||||
Directory dir = newDirectory();
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
|
||||
MockAnalyzer analyzer = new MockAnalyzer(random());
|
||||
analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(analyzer);
|
||||
MockDefaultFlushPolicy flushPolicy = new MockDefaultFlushPolicy();
|
||||
iwc.setFlushPolicy(flushPolicy);
|
||||
|
||||
|
@ -232,12 +236,14 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
|
|||
|
||||
int[] numThreads = new int[] { 4 + random().nextInt(8), 1 };
|
||||
final int numDocumentsToIndex = 50 + random().nextInt(50);
|
||||
MockAnalyzer analyzer = new MockAnalyzer(random());
|
||||
analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
|
||||
for (int i = 0; i < numThreads.length; i++) {
|
||||
AtomicInteger numDocs = new AtomicInteger(numDocumentsToIndex);
|
||||
MockDirectoryWrapper dir = newMockDirectory();
|
||||
// mock a very slow harddisk sometimes here so that flushing is very slow
|
||||
dir.setThrottling(MockDirectoryWrapper.Throttling.SOMETIMES);
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(analyzer);
|
||||
iwc.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
|
||||
iwc.setMaxBufferedDeleteTerms(IndexWriterConfig.DISABLE_AUTO_FLUSH);
|
||||
FlushPolicy flushPolicy = new FlushByRamOrCountsPolicy();
|
||||
|
|
Loading…
Reference in New Issue