Hello all,
I'd like to append an * (create a WildcardQuery) to each search term
in a query, such that a query that is entered as e.g. term1 AND
term2 is modified (effectively) to term1* AND term2*.
Parsing the search string is not very elegant (of course). I'm
thinking that overriding
Florian Hanke wrote:
I'd like to append an * (create a WildcardQuery) to each search term in
a query, such that a query that is entered as e.g. term1 AND term2 is
modified (effectively) to term1* AND term2*.
Parsing the search string is not very elegant (of course). I'm thinking
that
Thank you very much - that did the trick! :)
Am 17.03.2006 um 13:51 schrieb Eric Jain:
Perhaps you could subclass the QueryParser and override the
getFieldQuery method:
protected Query getFieldQuery(String field, String term) {
return new PrefixQuery(new Term(field, term));
}
Interestingly, the last two consulting jobs I've had dealt with this
very issue - having user entered terms be interpreted as partial
string to match in any indexed term. Care must be taken to avoid the
classic TooManyClauses exception or a more insidious OutOfMemory
exception.
By using