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]

Reply via email to