-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks a lot for your help Daniel, I have found a solution :)
The 'token' field is public inside QueryParser, and inside 'token.image' you can read the origin String with apostrophe. Thus, I can differ between the two situations - and simply return a BooleanQuery in the case there is no apostrophe. best regards Christian Daniel Noll schrieb: | 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] | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQFHx8UlQoTr50f1tpcRAtpvAKCPOzw/DbQeAbcAGr0gclWK+ROJawCfbmu9 9zM2QgBgozErW5sj7xGK1Ns= =nL71 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]