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 DF22E20049E for ; Thu, 10 Aug 2017 11:45:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DDA4D16AF66; Thu, 10 Aug 2017 09:45:33 +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 2EBB316AF5E for ; Thu, 10 Aug 2017 11:45:33 +0200 (CEST) Received: (qmail 90820 invoked by uid 500); 10 Aug 2017 09:45:27 -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 90788 invoked by uid 99); 10 Aug 2017 09:45:27 -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; Thu, 10 Aug 2017 09:45:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 433F6F3285; Thu, 10 Aug 2017 09:45:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jimczi@apache.org To: commits@lucene.apache.org Date: Thu, 10 Aug 2017 09:45:25 -0000 Message-Id: <9ee02113980a4f9885fb9e4133b82180@git.apache.org> In-Reply-To: <88b7033698af47cea7eadbc5b771e961@git.apache.org> References: <88b7033698af47cea7eadbc5b771e961@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] lucene-solr:branch_7_0: LUCENE-7914: AnalyzingSuggesterTest#testRandomRealisticKeys: trim big titles to make sure that they can pass the max recursion level in Operations#topsortState. archived-at: Thu, 10 Aug 2017 09:45:34 -0000 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/25ee0141 Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/25ee0141 Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/25ee0141 Branch: refs/heads/branch_7_0 Commit: 25ee0141c19b7f6156c2c439a59fad97f383b8cc Parents: a0aa0a0 Author: Jim Ferenczi Authored: Mon Aug 7 09:12:31 2017 +0200 Committer: Jim Ferenczi Committed: Thu Aug 10 11:44:52 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/25ee0141/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());