Don't let me discourage you from having a "FacetHandler" interface that
supports generic faceting functionality using different rules (ie:

I don't get discouraged -- I just take advice from smart people when
they offer it :).  I still do have my generic Facet handling
mechanism, because the Facets/FacetItems were always interfaces.  Now,
they end up as Map in a user cache instead of requiring a new breed of
handler,  which lets me accomplish much the same thing without doing
violence to Solr internals.

take a look at SolrIndexSearcher.getDocListAndSet -- it efficiently gets
you both the "paginated" DocList to display for this request and the full
DocSet for doing faceting at the same time, and it can also take in a list
of Filtering queries.  Then you can pass in the resulting DocSet as the
second arg to numDocs.

This perfectly fits my needs, but has one problem.  Since the
requestHandler flags are not passed through, XMLWriter throws a
NullPointerException when it encounters iterator.score() when trying
to write out a results.docList with scores.  Adding the flags argument
to the getDocListAndSet methods in SolrIndexSearcher appears to solve
that problem, i.e.:

 public DocListAndSet getDocListAndSet(Query query, List<Query>
filterList, Sort lsort, int offset, int len, int flags) throws
IOException {
   DocListAndSet ret = new DocListAndSet();
   getDocListC(ret,query,filterList,null,lsort,offset,len, flags |=
GET_DOCSET);
   return ret;
 }

as well as adding the flags argument to the other getDocListAndSet
method, so that the requestHandler flags are passed through.  Is there
a performance or other reason that flags are not present in the
getDocListAndSet signatures, as opposed to the getDocList, or should I
submit this as a JIRA issue/patch?

Thanks,
Greg

Reply via email to