You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/05/15 20:04:26 UTC
[09/39] lucene-solr:jira/solr-11779: [TEST] Fix TestNorms to ensure
that max token lenght is at least 3 to have predictable norms
[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/jira/solr-11779
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);