I have a custom search component which does the following in process

     SolrQueryRequest req = rb.req;
     SolrParams params = req.getParams();
        

     QueryWrapperFilter qwf = new QueryWrapperFilter(rb.getQuery());
                                        
     Filter filter = new TestFilter(qwf);
     ConstantScoreQuery fq = new ConstantScoreQuery(filter);
     rb.setQuery(fq);

this essentially filters the result set using TestFilter which does
this in getDocIdSet

return new FilteredDocSet(startingFilter.getDocIdSet(readerCtx));

where FilteredDocSet always returns true from match.  When a query is
executed that returns 0 results an IllegalArgumentException is thrown
from org.apache.lucene.search.FilteredDocIdSetIterator constructor

to fix this in FilteredDocSet I added the following:

        @Override
        public DocIdSetIterator iterator() throws IOException {
                try {
                        return super.iterator();
                } catch(IllegalArgumentException e){
                        return null;
                }
        }

What is the correct way to deal with this?  Am I getting this error
because I'm misusing something?

Reply via email to