lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiao, Jason (NSN - CN/Cheng Du)" <>
Subject RE: How to search
Date Tue, 26 Aug 2008 02:55:25 GMT
The lucene FAQ says:

What wildcard search support is available from Lucene?
Lucene supports wild card queries which allow you to perform searches
such as book*, which will find documents containing terms such as book,
bookstore, booklet, etc. Lucene refers to this type of a query as a
'prefix query'. 

Lucene also supports wild card queries which allow you to place a wild
card in the middle of the query term. For instance, you could make
searches like: mi*pelling. That will match both misspelling, which is
the correct way to spell this word, as well as mispelling, which is a
common spelling mistake. 

Another wild card character that you can use is '?', a question mark.
The ? will match a single character. This allows you to perform queries
such as Bra?il. Such a query will match both Brasil and Brazil. Lucene
refers to this type of a query as a 'wildcard query'. 

Leading wildcards (e.g. *ook) are not supported by the QueryParser by
default. As of Lucene 2.1, they can be enabled by calling
QueryParser.setAllowLeadingWildcard( true ). Note that this can be an
expensive operation: it requires scanning the list of tokens in the
index in its entirety to look for those that match the pattern. 

Jason Jiao

>-----Original Message-----
>From: ext Daniel Noll [] 
>Sent: Tuesday, August 26, 2008 10:50 AM
>Subject: Re: How to search
>Venkata Subbarayudu wrote:
>> Hi Anshum Gupta,
>>     Thanks for your replay, but when I gone through 
>> querySyntax-Document for Lucene, I read that Lucene does not allow 
>> queries like "*findthis" i.e. I think it doesnot allow 
>wildcards in the beginning of the query.
>It has supported this for some time now, just not by default.
>Daniel Noll
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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

View raw message