You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Ralf Hettesheimer <ra...@blue-order.com> on 2002/05/16 16:20:50 UTC

Re: [Bug 8307] - WildcardQuery broken for '?' characters in query

Hello,

I have to diagree, the bug is not fixed yet.
The problem here is that the bug is not in the WildcardQuery-class which the
Unit-Test checks but in the QueryParser. I have attached my version of
TestWildcard that additionally to the existing tests uses the QueryParser
and fails for any actual Lucene version.
I have looked into the QueryParser code and the problem appears to be the
differentiation between a TERM and a WILDTERM. If a term contains a question
mark it is not treated as a WILDTERM but as a TERM because the question mark
is a letter that can be part of a TERM. I have changed the definition of
TERM in my own QueryParser which I have attached too. With this version the
Unit-test works perfectly.

Another question concerning the QueryParser. I made another change to the
QueryParser (QueryParser2.jj) that allows to search for terms starting with
a wildcard. Is there any reason why Lucene does not support this by default?

Greetings
Ralf Hettesheimer

--
_______________________________________________________________________

Ralf Hettesheimer, Dipl.-Technoinform.               t e c m a t h  A G
Software Engineer                   Content Management Systems Division
phone +49 (0)631 303-5295 Europaallee 10, 67657 Kaiserslautern, Germany
fax   +49 (0)631 303-5210                        http://www.tecmath.com
_______________________________________________________________________

Re: [Bug 8307] - WildcardQuery broken for '?' characters in query

Posted by Brian Goetz <br...@quiotix.com>.
> I have looked into the QueryParser code and the problem appears to be the
> differentiation between a TERM and a WILDTERM. If a term contains a question
> mark it is not treated as a WILDTERM but as a TERM because the question mark
> is a letter that can be part of a TERM. 

This should be addressed in the unit test for the query parser.  Can
you provide me with examples of the queries that are parsed
incorrectly?

> Another question concerning the QueryParser. I made another change
> to the QueryParser (QueryParser2.jj) that allows to search for terms
> starting with a wildcard. Is there any reason why Lucene does not
> support this by default?

This was deliberate.  It would be a performance disaster.  

To repeat -- the query parser is syntactic sugar -- it makes it easier
to formulate the most common queries.  But it is exposed to end-users,
who may not know anything about searching.  We chose to restrict this
particlar feature to hand-created Query objects by apps that know what
they're doing.  There is no mandate that says "every query that can be
created with the Query classes should be creatable with the query
parser."  Instead, the idea is to present a nice, simple way of making
queries that end users can understand.  


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>