: ok, so does that mean i can use both q1 and q2 for phrase query ie; for : searching words adjacent to each other. Actually that was my only concern, : as i wanted to use q1 for phrase query, rather than q2. : Regards,
Your example "q1" is not hte correct syntax for a phrase query .. the correct syntax is to put quotes arround your words. you happen to be getting phrase queries for your "q1" example because of the analyzer you are using. QueryParser does one pass at parsing to look for special meta characters it udnerstands, and then passes the tokens it finds to your analyzer, if hte analyzer gives it back a stream of tokens it makes phrase query out of it... because your analyzer splits "apaceh&lucene" into two tokens, QueryParser makes a phrase query. you should not rely on this behavior, because if at some point your analyzer changes (or if you are using StandardAnalyzer and it encounters a situation where it assumes the "&" is a legitimate interword character (it might in cases i can't think of off hte top of my head) you won't get a phrase query, you'll get a single word query. use the syntax documented to get the behavior documented: if you don't like that syntax, you'll need a different query parser. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]