lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject [34/50] [abbrv] lucene-solr:jira/solr-11165: LUCENE-7914: AnalyzingSuggesterTest#testRandomRealisticKeys: trim big titles to make sure that they can pass the max recursion level in Operations#topsortState.
Date Tue, 08 Aug 2017 12:44:21 GMT
LUCENE-7914: AnalyzingSuggesterTest#testRandomRealisticKeys: trim big titles to make sure that
they can pass the max recursion level in Operations#topsortState.


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

Branch: refs/heads/jira/solr-11165
Commit: 6b3ea4d0c24adad9a270e43a3b5e07aac8317bee
Parents: 5f30765
Author: Jim Ferenczi <jimczi@apache.org>
Authored: Mon Aug 7 09:12:31 2017 +0200
Committer: Jim Ferenczi <jimczi@apache.org>
Committed: Mon Aug 7 09:12:31 2017 +0200

----------------------------------------------------------------------
 .../search/suggest/analyzing/AnalyzingSuggesterTest.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6b3ea4d0/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
b/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
index 06d44b9..67ff056 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/AnalyzingSuggesterTest.java
@@ -176,9 +176,11 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
       Document nextDoc = lineFile.nextDoc();
       String title = nextDoc.getField("title").stringValue();
       int randomWeight = random().nextInt(100);
-      keys.add(new Input(title, randomWeight));
-      if (!mapping.containsKey(title) || mapping.get(title) < randomWeight) {
-          mapping.put(title, Long.valueOf(randomWeight));
+      int maxLen = Math.min(title.length(), 500);
+      String prefix = title.substring(0, maxLen);
+      keys.add(new Input(prefix, randomWeight));
+      if (!mapping.containsKey(prefix) || mapping.get(prefix) < randomWeight) {
+        mapping.put(prefix, Long.valueOf(randomWeight));
       }
     }
     Analyzer indexAnalyzer = new MockAnalyzer(random());


Mime
View raw message