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 9EBB5200B50 for ; Fri, 29 Jul 2016 15:41:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9D4BE160A79; Fri, 29 Jul 2016 13:41:28 +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 E1A67160A6E for ; Fri, 29 Jul 2016 15:41:27 +0200 (CEST) Received: (qmail 96770 invoked by uid 500); 29 Jul 2016 13:41:26 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 96758 invoked by uid 99); 29 Jul 2016 13:41:26 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2016 13:41:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9FBEF189A29 for ; Fri, 29 Jul 2016 13:41:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.602 X-Spam-Level: X-Spam-Status: No, score=-1.602 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=sib.swiss Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Dkj6quG538tG for ; Fri, 29 Jul 2016 13:41:23 +0000 (UTC) Received: from bell.isb-sib.ch (bell-sib.unige.ch [192.33.215.135]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id EC21B5F24E for ; Fri, 29 Jul 2016 13:41:22 +0000 (UTC) Received: from bell (bell.isb-sib.ch [192.33.215.135]) by bell.isb-sib.ch with ESMTP id u6TDfFYg028013 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 29 Jul 2016 15:41:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sib.swiss; s=bellswiss; t=1469799677; bh=ChTRNyIZTqv3ZqmrrY9UjENunFQZ2As1sGOmUMu4YJU=; h=Subject:To:References:From:Date:In-Reply-To:From; b=yWbWornaQ/w6VVx2rU22LNoK8Mp4DNRKsKSZiQ9FoAu/oRtmHq+ykCJCVR9WFJR7/ SWGTGJEDGqA8WtAx1vXonm3faCBybc0AGZXnutW1CQLE2AZruNaFWBneOtAWJlCzud BZqHvmIDb4xhhiIGQNWD6BqMUVn2dOqsTUtN0Qbw= Subject: Re: get enumeration of all terms starting at a given term after lucene 4 To: java-user@lucene.apache.org References: <1469732226.728316.679646153.1DAB7CB3@webmail.messagingengine.com> <8076c7f9-4efb-be81-3b00-312d73a12e49@sib.swiss> From: Parit Bansal Message-ID: <3a9f9bcc-ee6e-6423-b272-62a0983e9f57@sib.swiss> Date: Fri, 29 Jul 2016 15:41:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner-Information: @sib.swiss Please contact SIB for more information X-MailScanner-ID: @sib.swiss u6TDfFYg028013 X-MailScanner: @sib.swiss Found to be clean X-MailScanner-From: @sib.swiss parit.bansal@sib.swiss archived-at: Fri, 29 Jul 2016 13:41:28 -0000 Hi Mukul, Provided terms are sorted how about doing if (termsEnum.seekExact(text)) { BytesRef text; while ((text = con.foreignTermsEnum.next()) != null) { // keep looping till your value is a prefix } } - Parit On 07/29/2016 03:30 PM, Mukul Ranjan wrote: > Hi Parit, > > PrefixTermsEnum is removed in lucene 5.1 so we can not use this now. > > Thanks, > Mukul > > -----Original Message----- > From: Parit Bansal [mailto:Parit.Bansal@sib.swiss] > Sent: Friday, July 29, 2016 3:20 PM > To: java-user@lucene.apache.org > Subject: Re: get enumeration of all terms starting at a given term after lucene 4 > > On 07/29/2016 08:27 AM, Mukul Ranjan wrote: >> lucene version from lucene 3.6 to lucene 5.5.2. After 3.6, >>> indexReader terms api is removed which used to give list of terms. >>> I have used below code to get the termEnum, but it has no option to >>> pass the value of the field which is used to get the matching result. >>> >>> Terms terms = MultiFields.getTerms(reader, TEXT_FIELD); TermsEnum >>> termsEnum = terms.iterator(); >>> >>> Can anyone help me on this. > Hi Mukul, > > How about using PrefixTermsEnum like: > > Terms terms = MultiFields.getTerms(reader, TEXT_FIELD); TermsEnum termsEnum = new PrefixTermsEnum(tenum, terms.iterator()); > > - Best > Parit > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ___ Watch an eGain Customer Service Transformation Success Story > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org