R2.4
There is much about Lucene that I do not understand, so it may be that there is
some simple or obvious mistake I am making. I build an index, get hits
(documents) back from it, with various non-zero scores. Now I call this code:
Explanation expl = _searcher.explain(rewrite, docIndex); // always
null!
And the return value is *ALWAYS* null. The javadocs on explain() do not even
mention that possibility. When I debug through the call, I find the
"explanation" in this code inside class MarkupContainsQuery (which is the code
that gets called):
/**
* @see Weight#explain(IndexReader, int)
*/
public Explanation explain(IndexReader reader, int doc)
throws IOException {
if (reader == null) {
throw new IOException("Empty reader in explain
method");
}
// TODO SY - implement
>>>>>>>>> return null;
}
This seems, um, bad, esp. as I did nothing to *decide* the type of my query,
but merely created it from the user-entered string like this:
Query query = _parser.parse(queryString);
Query rewrite = query.rewrite(_reader);
And the field _parser was created like this:
Analyzer analyzer = new StandardAnalyzer();
QueryParser parser = new QueryParser("contents", analyzer);
_parser XMLFragmentParser(parser);
So -- what's the right thing to do?
thanks,
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]