Hey there, I'm wondering if there's a more clean way to to this: I've written a SearchComponent, that runs as last-component. In the prepare method I build a DocSet (SortedIntDocSet) based on if some values of the fieldCache of a determined field accomplish some rules (if rules are accomplished, set the docId to the DocSet). I want to use this DocSet as a filter for the main query. Right now I'm cloning the existent filters of the request (if they exist at all) to a filter list and add mine there. Then add the list to the request Context:
... build myDocSet DocSet ds = rb.req.getSearcher().getDocSet(filtersCloned).andNot(myDocSet); rb.setFilters(null); //you'll see why rb.req.getContext().put("newFilters",ds); Then to apply the DocSet containing all filters, in the QueryCommand process method do: SolrIndexSearcher.QueryCommand cmd = rb.getQueryCommand(); if(rb.req.getContext().containsKey("newFilters")){ cmd.setFilter((DocSet)rb.req.getContext().get("newFilters")); } As I've set rb.setFilters(null) I won't have exceptions and it will work. This looks definitely nasty, I would like not to touch the QueryCommand. Any suggestions? -- View this message in context: http://lucene.472066.n3.nabble.com/Adding-a-DocSet-as-a-filter-from-a-custom-search-component-tp3452449p3452449.html Sent from the Solr - User mailing list archive at Nabble.com.