On Wednesday 27 February 2008 00:50:04 [EMAIL PROTECTED] wrote: > Looks that this is really hard-coded behaviour, and not Analyzer-specific.
The whitespace part is coded into QueryParser.jj, yes. So are the quotes and : and other query-specific things. > I want to search for directories with tokenizing them, e.g. > /home/reuschling - this seems to be not possible with the current > queryparser. That's possible by changing the analyser. For instance StandardAnalyzer will tokenise that as two terms, but WhitespaceAnalyzer will tokenise it as one. > | If you subclass QueryParser than you can override this method and modify > | it to do whatever evil trick you want to do. > > Overriding getFieldQuery() will not work because I can't differ between > "home/reuschling", which should trigger a PhraseQuery, and home/reuschling > without apostrophe, which should trigger a BooleanQuery...I will search > whether I can find a better place for this:) That much is true. Likewise, there is no difference between quoting "cat" and typing cat without quotes. You could possibly override the parse(String) method and mangle the string in some way so that you know. So if the user enters /a/b it could pass down /a/b, but if they enter "/a/b" it could pass down "SOMETHING/a/b", and you then detect the SOMETHING in getFieldQuery. Just have to make sure the something isn't tokenised out by the analyser. Or you could clone QueryParser.jj itself and modify it to call different methods for the two situations. Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]