lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Kor <>
Subject Re: Trying To Understand Query Syntax Details
Date Wed, 17 Oct 2001 01:56:59 GMT

--- "W. Eliot Kimber" <> wrote:
> I'm trying to understand the details of the query
> syntax. I found the
> syntax ` in QueryParser.jj, but it doesn't make
> everything clear.
> My initial questions:
> - It doesn't appear that "?" can be the last
> character in a search. For
> example, to match "fool" and "food", I tried to do
> "foo?", but got a
> parse error. "fo?l" of course matches fool and foal.
> Is this a bug or an
> implementation constraint?

Yes and no. Lucene uses two query classes to handle
wildcards, namely PrefixQuery and WildcardQuery. 

To cut the long story short, PrefixQuery, the faster
of the two, is expressly optimized for wildcards
searches like "foo*" and "foa*" but doesn't yet
support single character matching like "foo?". 

WildcardQuery, the slower of the two and developed
after PrefixQuery was completed, handles general
wildcard searches like "fo*l" as well as "fo?l". 

I'll see what I can do to add single character
matching to PrefixQuery over the weekend. 

> - How does one specify a date range in a query? We
> need to be able to
> search on "docs later than date x", and I know that
> Lucene supports date
> matching, but I don't see how to specify this in a
> query.

Try looking at Range Query.

> Also, is there a description of the algorithm "~"
> uses?

"~" is used to toggle fuzzy search on a single word.
Thus the search "foam~" will match with terms like
"foam", "form", "foal", "roam", etc..

Do You Yahoo!?
Make a great connection at Yahoo! Personals.

View raw message