Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 80286 invoked from network); 5 Jun 2006 15:08:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jun 2006 15:08:15 -0000 Received: (qmail 38942 invoked by uid 500); 5 Jun 2006 15:08:08 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 38893 invoked by uid 500); 5 Jun 2006 15:08:07 -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 38881 invoked by uid 99); 5 Jun 2006 15:08:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 08:08:07 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [81.228.8.164] (HELO pne-smtpout2-sn2.hy.skanova.net) (81.228.8.164) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 08:08:04 -0700 Received: from [192.168.0.102] (83.249.41.244) by pne-smtpout2-sn2.hy.skanova.net (7.2.072.1) id 44840D270000EA82 for java-user@lucene.apache.org; Mon, 5 Jun 2006 17:07:39 +0200 Subject: Re: query parser field name aliases From: karl wettin To: java-user@lucene.apache.org In-Reply-To: <448380E5.3040000@nuix.com.au> References: <1149458259.4892.66.camel@localhost> <448380E5.3040000@nuix.com.au> Content-Type: text/plain Organization: snigel heavy industries Date: Mon, 05 Jun 2006 17:07:34 +0200 Message-Id: <1149520055.4892.120.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Mon, 2006-06-05 at 10:55 +1000, Daniel Noll wrote: > Erik Hatcher wrote: > > > > On Jun 4, 2006, at 5:57 PM, karl wettin wrote: > >> I was thinking it could be nice if the query parser handled aliases by > > > > Rather than hacking QueryParser, simply do some regex replaces on the > > string before handing it to parser. n:karl would get replaced with > > name:karl. ([a-z]*)\: replaced with the field name that matches $1. > > It seems a little more elegant to extend from QueryParser in this > situation. Override getFieldQuery which gets passed the field name > string, and all you'd have to do is call the method in the superclass > after modifying the field name. There is a problem with this. Java does not allow multiple inheritance and there are other subclasses of QueryParser. Perhaps I can fix it with a decorator instead. Thanks for the ideas! --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org