lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artur Tomusiak <>
Subject How to make Lucene search for parts of terms?
Date Mon, 10 Nov 2008 22:30:33 GMT

We are using a MultiFieldQueryParser and we have problems with making 
Lucene find parts of words. So that for example searching for "a" will 
find all the results that contain "a" in it, not only as a separate 
token, but even inside of the tokens (like word "make").

We tried putting wildcards around each search term but then we were 
unable to reconstruct the original query because keywords like "AND" or 
"OR" are not considered search terms. Also, our analyzer was including 
special characters, like '(' as parts of the terms.

Do you know the best way of making this work? We are looking for a way 
that would search correctly even more advanced queries, like:

(a OR b) AND c

This should end up finding all results that contain letter 'c' and 
either 'a' or 'b' in any of the fields (please remember that we are 
using MultiFieldQueryParser).

In the example above, based on our code, wrapping every term in 
wildcards ended up with this query:

*(a* *b)* *c*

while we would expect something like this:

(*a* OR *b*) AND *c*

Do you know the best way of accomplishing it?

Thank you,
Artur Tomusiak

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message