lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: advanced WildcardQuery
Date Wed, 16 Jul 2008 17:12:02 GMT
Check query.toString(), but I think the problem is that Lucene is
looking for a single term (word?) that starts with "pretty" and ends
with "car". So this should match "prettynicecar" but not
"pretty nice car" since the latter is split into separate tokens.

If you're concerned only with whole-word terms, you can think about
phrase queries with an appropriate slop. Beware, phrase queries
aren't tokenized, so the following phrase query wouldn't do what
you want "pret* car"~5 if you submit it *with* the quotes.

You could also use SpanQuery, but again that would be
easier if you're only concerned with whole words.

Building up a wildcard query with pretty* car should work too.

Best
Erick

On Wed, Jul 16, 2008 at 12:09 PM, legrand thomas <thomaslegrand14@yahoo.fr>
wrote:

>
> Dear all,
>
> I'd like to search on long titles (tokenized and stored) using the
> WildcardQuery. Considering the following example:
>
> title="pretty car for sale"
>
> If I search for "pretty*", I get the document having this title. But it's
> not the case if I build a WilcardQuery with the term "pretty*car". I also
> want to get this document when searching for "pretty*sale*". How should I do
> ? Is it really possible ?
>
> I use lucene 2.3.1.
>
> Thanks in advance,
>
> Thomas Legrand
>
>
>
>
>  _____________________________________________________________________________
> Envoyez avec Yahoo! Mail. Une boite mail plus intelligente
> http://mail.yahoo.fr
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message