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
passing a Map to the parser. The data could be compiled from the index.
"name", "nam", "na" and "n" all trigger on "name", taking there is no
other field starting with an "n".
Did anyone implement this, or should I hack one up?
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. Done, and no regexes required.
Daniel
--
Daniel Noll
Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/ Fax: +61 2 9212 6902
This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]