lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: Lucene QueryParser and Analyzer
Date Sun, 02 May 2010 19:48:25 GMT
> 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


Mime
View raw message