[pylucene-dev] can't override QueryParser.parse()

Andi Vajda vajda at osafoundation.org
Tue Nov 13 19:47:10 PST 2007


On Tue, 13 Nov 2007, Bill Janssen wrote:

> It crashes for me, too, when I run it with an unmodified JCC.
>
> To get the error I reported, I use a much larger codebase.  But I
> think it's the same problem -- the 'value' field isn't of the type
> reported by the 'exc' field.  And it's crashing in the same place,
> in the call to the Java implementation of getBooleanQuery.

It's crashing because your code example is a little screwy. It's passing a 
MultiFieldQueryParser instance to a QueryParser wrapper. The C++ methods on 
the C++/JNI wrapper are not virtual and hence this is not going to do what you 
think. The fact that getBooleanQuery() is even called makes no sense if what 
you're invoking is parse().

The right way to make the call is:
   p.parse("foo AND bar")

which may or may not be what you want because MultiFieldQueryParser.parse() is 
static and QueryParser.parse() is not. The choice of method names here is 
unfortunate.

The "Lucene in Action" CustomQueryParser.py sample works fine. If you don't 
send me a piece of code that reproduces the problem, I'm afraid there is not 
much I can do to help you.

Andi..



More information about the pylucene-dev mailing list