lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lee Mallabone" <...@grantadesign.com>
Subject Re: Highlighting terms, new white paper
Date Tue, 16 Oct 2001 14:37:15 GMT
> I tested by directly creating a WildcardQuery, and it worked okay for
> me.

Ah. I'm using the queryParser, so it was slightly less obvious what queries
were created for what.

> As you can see from the trace, the exception occurs in MultiTermQuery.
> As what I can see from the source, it looks like WildcardQuery.setEnum()
> has not been called before. I have to admit that I don't know much about
> the internals of MultiTermQuery and its subclasses, except for a basic
> understanding of what they do (that is, constructing a BooleanQuery).

I've just done a whole bunch of code browsing/digging, and  it's as you
suspected - the WildcardQuery.prepare() method must be executed so that the
enum is set correctly. It turns out that this gets done when
Searcher.search() is called.

So I think the summary of this is that LuceneTools.getTerms() will crash if
a query containing wildcards has been parsed but not executed?

This certainly isn't the end of the world, but maybe it should be noted in
the docs?

I'd offer a code fix, but I suspect WildcardQuery.prepare() isn't public for
a good reason...

Thanks again,

Lee Mallabone.



Mime
View raw message