A small comment. You mentioned Hashtable. As you are probably already creating a new QueryParser instance for every search, you most likely don't need a (synchronized) Hashtable and can use the unsynchronized HashMap.
Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ----- Original Message ---- From: Jan Peter Stotz <[EMAIL PROTECTED]> To: java-user@lucene.apache.org Sent: Saturday, January 19, 2008 1:54:18 PM Subject: Re: Creating an alias for a field name? Hi Erick, thanks for your response. > Not that I know of. I presume that you want this to reduct typing > or some such. Your app could simply massage the query > that was typed, doing the appropriate substitutions before > parsing the query.... Well I found a much better solution which avoids "double parsing". I created my own QueryParser by extending the existing. Then I identified five methods to override: getFieldQuery(String field,String queryText) getFuzzyQuery(String field,String termStr, float minSimilarity) getPrefixQuery(String field,String termStr) getRangeQuery(String field,String part1, String part2, boolean inclusive) getWildcardQuery(String field,String termStr) In each of this methods I call my own method: field = translateField(field); before passing the values to it's super implementation. And my translateField method uses a Hashtable for looking up field aliases. It it finds an alias it returns it, otherwise the field is returned without modification. Therefore I have my field aliases without having to implement an own parser - thanks to the good OO-design of the QueryParser class. BTW: If someone wants to took onto the complete source just ask. I did not want to attach/include them because of its size (most of the code has been generated by Eclipse...) Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]