Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 55209 invoked from network); 1 Sep 2008 13:40:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Sep 2008 13:40:02 -0000 Received: (qmail 51164 invoked by uid 500); 1 Sep 2008 13:39:54 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 51121 invoked by uid 500); 1 Sep 2008 13:39:54 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 51112 invoked by uid 99); 1 Sep 2008 13:39:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2008 06:39:54 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [72.14.204.238] (HELO qb-out-0506.google.com) (72.14.204.238) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2008 13:38:54 +0000 Received: by qb-out-0506.google.com with SMTP id o24so1228683qba.1 for ; Mon, 01 Sep 2008 06:39:22 -0700 (PDT) Received: by 10.86.65.11 with SMTP id n11mr4590267fga.64.1220276362041; Mon, 01 Sep 2008 06:39:22 -0700 (PDT) Received: from ?192.168.100.52? ( [217.72.91.237]) by mx.google.com with ESMTPS id l12sm6623743fgb.6.2008.09.01.06.39.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 01 Sep 2008 06:39:21 -0700 (PDT) Subject: Re: Multi Phrase Search at the Beginning of a field From: Andraz Tori To: java-dev@lucene.apache.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Organization: Zemanta Date: Mon, 01 Sep 2008 15:38:38 +0200 Message-Id: <1220276318.6099.111.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org You can use standard trick. Insert a special token at the beginning of every field you are indexing, and add that special token to beginning of every query. Since this token will not occur anywhere else in the field, you will know that your queries match only beginnings of fields bye andraz On Mon, 2008-09-01 at 15:50 +0300, ext-vinay.thota@nokia.com wrote: > Hi, > > Can some one please help me in providing a solution for my problem: > > I have a single field defined in my document. Now I want to do a > MultiPhraseQuery - but at the beginning of the field. > > For e.g: If there are 3 documents with single field ( say 'title' ) > has the values -> "Hello Love you", "Love You Sister", "Love Yoxyz" > > Then my search for "Love yo*" -> MultiPhraseQuery with first term > "Love" ( using addTerm("Love") and the next terms ( using > addTerms("Yo*" - after getting all terms 'You' and 'Yoxyz' using > IndexReader.terms(Yo) ) should return only the documents "Love You > Sister", "Love Yoxyz" - but not "Hello Love you". > > Can some one please help me on how to get it done. > > > Regards, > Vinay > -- Andraz Tori, CTO Zemanta Ltd, London, Ljubljana www.zemanta.com mail: andraz@zemanta.com tel: +386 41 515 767 twitter: andraz, skype: minmax_test --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org