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:04:41 UTC

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

Repository: lucene-solr
Updated Branches:
  refs/heads/master 1705e4f29 -> 6262b7757


[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/6262b775
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6262b775
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6262b775

Branch: refs/heads/master
Commit: 6262b7757b843dd3bb41e86e334c832cec72d161
Parents: 1705e4f
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:04:18 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/6262b775/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 4100885..82ac27d 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);