You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/10/30 19:11:44 UTC
svn commit: r1711532 - in /lucene/dev/branches/branch_5x/lucene: analysis/
core/src/test/org/apache/lucene/index/TestCheckIndex.java
Author: mikemccand
Date: Fri Oct 30 18:11:43 2015
New Revision: 1711532
URL: http://svn.apache.org/viewvc?rev=1711532&view=rev
Log:
LUCENE-6866: limit max token length
Modified:
lucene/dev/branches/branch_5x/lucene/analysis/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java
Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java?rev=1711532&r1=1711531&r2=1711532&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java Fri Oct 30 18:11:43 2015
@@ -17,17 +17,12 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import java.io.IOException;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.PrintStream;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
-import org.apache.lucene.util.IOUtils;
-import org.apache.lucene.util.LineFileDocs;
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.MockAnalyzer;
@@ -36,6 +31,12 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.LineFileDocs;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
public class TestCheckIndex extends LuceneTestCase {
@@ -126,7 +127,8 @@ public class TestCheckIndex extends Luce
public void testChecksumsOnly() throws IOException {
LineFileDocs lf = new LineFileDocs(random());
Directory dir = newDirectory();
- Analyzer analyzer = new MockAnalyzer(random());
+ MockAnalyzer analyzer = new MockAnalyzer(random());
+ analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(analyzer));
for (int i = 0; i < 100; i++) {
iw.addDocument(lf.nextDoc());
@@ -150,7 +152,8 @@ public class TestCheckIndex extends Luce
public void testChecksumsOnlyVerbose() throws IOException {
LineFileDocs lf = new LineFileDocs(random());
Directory dir = newDirectory();
- Analyzer analyzer = new MockAnalyzer(random());
+ MockAnalyzer analyzer = new MockAnalyzer(random());
+ analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(analyzer));
for (int i = 0; i < 100; i++) {
iw.addDocument(lf.nextDoc());