lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Byrne <>
Subject Re: question about wildcard like search
Date Fri, 17 Oct 2008 07:42:16 GMT

I think you'll normally get quicker answers for this type of question on 
the main Lucene users mailing list:

Anyway, you just need to call the QueryParser method 
'setAllowLeadingWildcard(true)' to allow leading wildcards.

 However, once you do that, your leading wildcard queries will probably 
expand into many terms, and you should also therefore call 
'BooleanQuery.setMaxClauseCount' with a large number - you could use 
Integer.MAX_VALUE, but as far as I know this can cause a problem if you 
use FuzzyQuerys. The number of terms in your index is the largest you'll 
need - but presumably that can grow.

I would just set it at 1 million or something like that. You're problaby 
never going to have a million terms.


ChadDavis wrote:
> I need to do a query where i'm looking for strings that are embedded into a
> single word in one of the fields.  In other words, a field my have a phrase
> like:
> Bob,Tom,Kevin,Jeff
> or
> Tom,Doug,Steven,Bob
> I would like to be able to use the wildcard query to search for any document
> that has the name "Tom" embedded, in any fashion, in this field.
> I would like to have built a WildCardQuery like "*Tom*", but it doesn't
> accept * as the first character, due to performance reasons the
> documentation explains.
> So, how do I do such a query?  I'm looking into the fuzzy logic query, right
> now.
> ------------------------------------------------------------------------
> No virus found in this incoming message.
> Checked by AVG - 
> Version: 8.0.173 / Virus Database: 270.8.1/1728 - Release Date: 10/16/2008 7:38 AM

View raw message