From lucene-user-return-13015-apmail-jakarta-lucene-user-archive=jakarta.apache.org@jakarta.apache.org Sat Feb 05 01:07:55 2005 Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 49701 invoked from network); 5 Feb 2005 01:07:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Feb 2005 01:07:55 -0000 Received: (qmail 63579 invoked by uid 500); 5 Feb 2005 01:07:42 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 63559 invoked by uid 500); 5 Feb 2005 01:07:42 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 63546 invoked by uid 99); 5 Feb 2005 01:07:42 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from fork3.mail.Virginia.EDU (HELO fork3.mail.virginia.edu) (128.143.2.193) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 04 Feb 2005 17:07:41 -0800 Received: from localhost (localhost [127.0.0.1]) by fork3.mail.virginia.edu (Postfix) with ESMTP id E18EE1C08A for ; Fri, 4 Feb 2005 20:07:38 -0500 (EST) Received: from fork3.mail.virginia.edu ([127.0.0.1]) by localhost (fork3.mail.virginia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29664-07 for ; Fri, 4 Feb 2005 20:07:38 -0500 (EST) Received: from [192.168.1.102] (va-chrvlle-cad1-bdgrp1-4b-b-169.chvlva.adelphia.net [68.169.41.169]) by fork3.mail.virginia.edu (Postfix) with ESMTP id 742DC1BFCF for ; Fri, 4 Feb 2005 20:07:38 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v619.2) In-Reply-To: <03d601c50b1c$ae6ff5d0$7703d00a@hypermedia.com> References: <20050204165525.23042.qmail@web30201.mail.mud.yahoo.com> <03d601c50b1c$ae6ff5d0$7703d00a@hypermedia.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <1081c493bd80a555f390191c641f9c45@ehatchersolutions.com> Content-Transfer-Encoding: 7bit From: Erik Hatcher Subject: Re: Starts With x and Ends With x Queries Date: Fri, 4 Feb 2005 20:07:35 -0500 To: "Lucene Users List" X-Mailer: Apple Mail (2.619.2) X-UVA-Virus-Scanned: by amavisd-new at fork3.mail.virginia.edu X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N It matches both because you're tokenizing the name field. In both documents, the name field has a "testing" term in it (it gets lowercased also). A PrefixQuery matches terms that start with the prefix. Use an untokenized field type (Field.Keyword) if you want to keep the entire original string as-is for searching purposes - however you'd have issues with case-sensitivity in your example. Also keep in mind that QueryParser only allows a trailing asterisk, creating a PrefixQuery. However, if you use a WildcardQuery directly, you can use an asterisk as the starting character (at the risk of performance). Erik On Feb 4, 2005, at 7:50 PM, Luke Shannon wrote: > Hello; > > I have these two documents: > > Text > Keyword > Text > Text > Text > Text > Text > Text > Text > Text > Text > > > Text > Text > Text > Keyword > Keyword > Text > Text > Text > Text > Text > Text > Text > Text Canada' > Brand Ide.> > Text > Text > > I would like to be able to match a name fields that starts with testing > (specifically) and those that end with it. > > I thought the below code would parse to a Prefix Query that would > satisfy my > starting requirment (maybe I don't understand what this query is for). > But > this matches both. > > Query query = QueryParser.parse("testing*", "name", new > StandardAnalyzer()); > > Has anyone done this before? Any tips? > > Thanks, > > Luke > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org