lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <>
Subject Filter.getDocIdSet() returning null, and what this means for CachingWrapperFilter
Date Wed, 26 May 2010 06:56:33 GMT
Hi all.

We are seeing an exception like this:


The class of our own is just an intermediary which delays creating the
Filter object...

        public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
            if (delegate == null) {
                delegate = factory.createFilter();
            return delegate.getDocIdSet(reader);

Tracing through the code in CachingWrapperFilter, I can see that this
NPE would occur if getDocIdSet() were to return null.

The Javadoc on Filter says that null will be returned if no documents
will be accepted by the filter, but it doesn't seem that Lucene itself
is handling null return values correctly, so which is correct?  The
code or the Javadoc?  Supposing that null really is OK, does this
cause any problems with how CachingWrapperFilter is implementing the
caching?  I notice it's calling get() and then comparing against null
so it wouldn't appear that it can distinguish "the entry isn't in the
cache" from "the entry is in the cache but it's null".


Daniel Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis                                and eDiscovery software

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message