lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [01/36] lucene-solr:feature/autoscaling_72: LUCENE-7914: Fix TestSuggestField#testRealisticKeys: trim big titles to make sure that they can pass the max recursion level in Operations#topsortState.
Date Mon, 14 Aug 2017 12:40:00 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/feature/autoscaling_72 104578312 -> 5c691d454


 LUCENE-7914: Fix TestSuggestField#testRealisticKeys: 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/2a8930cf
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2a8930cf
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2a8930cf

Branch: refs/heads/feature/autoscaling_72
Commit: 2a8930cf838b323eeadba240eb7141ec1f14ca6d
Parents: a4db6ce
Author: Jim Ferenczi <jimczi@apache.org>
Authored: Tue Aug 8 14:25:23 2017 +0200
Committer: Jim Ferenczi <jimczi@apache.org>
Committed: Tue Aug 8 14:25:23 2017 +0200

----------------------------------------------------------------------
 .../lucene/search/suggest/document/TestSuggestField.java     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2a8930cf/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
----------------------------------------------------------------------
diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
index a797ca5..a6659e0 100644
--- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
+++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
@@ -719,13 +719,15 @@ public class TestSuggestField extends LuceneTestCase {
     for (int i = 0; i < num; i++) {
       Document document = lineFileDocs.nextDoc();
       String title = document.getField("title").stringValue();
+      int maxLen = Math.min(title.length(), 500);
+      String prefix = title.substring(0, maxLen);
       int weight = random().nextInt(Integer.MAX_VALUE);
-      Integer prevWeight = mappings.get(title);
+      Integer prevWeight = mappings.get(prefix);
       if (prevWeight == null || prevWeight < weight) {
-        mappings.put(title, weight);
+        mappings.put(prefix, weight);
       }
       Document doc = new Document();
-      doc.add(new SuggestField("suggest_field", title, weight));
+      doc.add(new SuggestField("suggest_field", prefix, weight));
       iw.addDocument(doc);
 
       if (rarely()) {


Mime
View raw message