You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2018/05/09 08:05:30 UTC

lucene-solr:branch_7x: [TEST] Fix TestNorms to ensure that max token lenght is at least 3 to have predictable norms

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 586fb0272 -> 7e19c6c32


[TEST] Fix TestNorms to ensure that max token lenght is at least 3 to have predictable norms


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7e19c6c3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7e19c6c3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7e19c6c3

Branch: refs/heads/branch_7x
Commit: 7e19c6c32d68f5db65536d865e857a1e3b009729
Parents: 586fb02
Author: Simon Willnauer <si...@apache.org>
Authored: Wed May 9 10:04:18 2018 +0200
Committer: Simon Willnauer <si...@apache.org>
Committed: Wed May 9 10:05:19 2018 +0200

----------------------------------------------------------------------
 lucene/core/src/test/org/apache/lucene/index/TestNorms.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7e19c6c3/lucene/core/src/test/org/apache/lucene/index/TestNorms.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestNorms.java b/lucene/core/src/test/org/apache/lucene/index/TestNorms.java
index 70c7a32..05a774e 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestNorms.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestNorms.java
@@ -69,7 +69,8 @@ public class TestNorms extends LuceneTestCase {
   public void buildIndex(Directory dir) throws IOException {
     Random random = random();
     MockAnalyzer analyzer = new MockAnalyzer(random());
-    analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 1, IndexWriter.MAX_TERM_LENGTH));
+    // we need at least 3 for maxTokenLength otherwise norms are messed up
+    analyzer.setMaxTokenLength(TestUtil.nextInt(random(), 3, IndexWriter.MAX_TERM_LENGTH));
     IndexWriterConfig config = newIndexWriterConfig(analyzer);
     Similarity provider = new MySimProvider();
     config.setSimilarity(provider);