Left wildcards seem to work if you explicitly use a
WildcardQuery e.g. 

        Term t = new Term("id", "*ucene");
        Query query = new WildcardQuery(t);


but if use QueryParser with an analyzer e.g.

        Analyzer analyzer = new StandardAnalyzer();
        Query query = QueryParser.parse("*ucene", "id", analyzer);

get an exception:

org.apache.lucene.queryParser.ParseException: 
Lexical error at line 1, column 1.  Encountered: "*" (42), after : ""
  at org.apache.lucene.queryParser.QueryParser.parse(Unknown Source)


Tested on RC5.  Haven't tried other ways of building a query.  In my
simple tests terms with left and right wildcards like "*lucene*"
worked too, even if the whole word was included.



--
Ian.
[EMAIL PROTECTED]


> [EMAIL PROTECTED] (Christian Schrader) wrote 
>
> It works with the nightly builds and probably with 1.2-RC5 :-)
> 
> Christian
> > -----Ursprungliche Nachricht-----
> > Von: Otis Gospodnetic [mailto:[EMAIL PROTECTED]]
> > Gesendet: 07 May 2002 17:31
> > An: Lucene Users List
> > Betreff: Re: WildcardQuery
> > 
> > 
> > Yes, me too.  I just tried it on some Lucene index (the search at
> > blink.com) and it doesn't seem to work (try searching for travel and
> > then *vel).
> > I'm assuming the original poster confused something...
> > 
> > Otis
> > 
> > --- Joel Bernstein <[EMAIL PROTECTED]> wrote:
> > > I thought Lucene didn't support left wildcards like the following:
> > > 
> > > *ucene
> > > 
> > > ----- Original Message -----
> > > From: "Christian Schrader" <[EMAIL PROTECTED]>
> > > To: "Lucene Users List" <[EMAIL PROTECTED]>
> > > Sent: Monday, May 06, 2002 7:14 PM
> > > Subject: WildcardQuery
> > > 
> > > 
> > > > I am pretty happy with the results of WildcardQueries like "*ucen*"
> > > that
> > > > matches lucene, but "*lucene*" doesn't match lucene. Is there a
> > > reason for
> > > > this? And what would be the patch.
> > > > It should be in WildcardTermEnum. I am wondering if somebody
> > > already
> > > patched
> > > > it?
> > > >
> > > > Thanks, Chris

----------------------------------------------------------------------
Searchable personal storage and archiving from http://www.digimem.net/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to