Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 41A5720049B for ; Mon, 14 Aug 2017 14:40:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3FFD81650E3; Mon, 14 Aug 2017 12:40:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 85D621650D3 for ; Mon, 14 Aug 2017 14:40:03 +0200 (CEST) Received: (qmail 36368 invoked by uid 500); 14 Aug 2017 12:40:00 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 36350 invoked by uid 99); 14 Aug 2017 12:40:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2017 12:40:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B50D7DFA43; Mon, 14 Aug 2017 12:40:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ab@apache.org To: commits@lucene.apache.org Date: Mon, 14 Aug 2017 12:40:00 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer 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. archived-at: Mon, 14 Aug 2017 12:40:04 -0000 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 Authored: Tue Aug 8 14:25:23 2017 +0200 Committer: Jim Ferenczi 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()) {