You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ahmet Arslan <io...@yahoo.com> on 2010/05/02 21:48:25 UTC

Re: Lucene QueryParser and Analyzer

> I think I've figured out what the
> problem is. Given the inputs,
> 
> Input1: C1C2,C3C4,C5C6,C7,C8C9C10
> Input2: C1C2  C3C4  C5C6  C7  C8C9C10
> 
> Input1 gets parsed as
> Query1: (text: "C1C2  C3C4  C5C6  C7 
> C8C9C10")
> whereas Input2 gets parsed as
> Query2: (text: "C1C2") (text: "C3C4") (text: "C5C6") (text:
> "C7") (text: 
> "C8C9C10")
> 
> That is, Lucene constructs the query and then pass the
> query text 
> through the analyzer. Is there any way to
> force QueryParser to pass the input string through the
> analyzer before 
> creating the query? That is, force Lucene
> to create Query2 for both Input1 and Input2.

QueryParser tokenizes input query string using white-spaces. You can alter this behavior to ways: 

1-) escaping whitespaces with backslash, e.g. C1C2\ C3C4\ C5C6\ C7\ C8C9C10
2-) using quotes, e.g. "C1C2  C3C4  C5C6  C7  C8C9C10"


      

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org