*/
@Override
public void process(ResponseBuilder rb) throws IOException
{
SolrQueryRequest req = rb.req;
SolrQueryResponse rsp = rb.rsp;
SolrParams params = req.getParams();
if (!params.getBool(COMPONENT_NAME, true)) {
return;
}
SolrIndexSearcher searcher = req.getSearcher();
if (rb.getQueryCommand().getOffset() < 0) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "'start' parameter cannot be negative");
}
// -1 as flag if not set.
long timeAllowed = (long)params.getInt( CommonParams.TIME_ALLOWED, -1 );
SolrIndexSearcher.QueryCommand cmd = rb.getQueryCommand();
cmd.setTimeAllowed(timeAllowed);
SolrIndexSearcher.QueryResult result = new SolrIndexSearcher.QueryResult();
if(params.getBool("fetchfdt", false))
{
String crcget=params.get("mdrill.crc.key.get",null);
if(crcget!=null)
{
result.setDocSet(new BitDocSet());
}else{
//TODO QUICK TOP N
ArrayList<Query> qlist=new ArrayList<Query>();
List<Query> list=rb.getFilters();
if(list!=null)
{
for(Query q:list)
{
qlist.add(q);
}
}
qlist.add(rb.getQuery());
BooleanQuery query=new BooleanQuery();
for(Query q:qlist)
{
query.add(q, BooleanClause.Occur.MUST);
}
int offset = params.getInt(FacetParams.FACET_CROSS_OFFSET, 0);
int limit = params.getInt(FacetParams.FACET_CROSS_LIMIT, 100);
int limit_offset=offset+limit;
FdtMdrillCollector coll=new FdtMdrillCollector(limit_offset+2,searcher.maxDoc());
searcher.ScoreFind(query, null,coll);
result.setDocSet(new BitDocSet(coll.getBits()));
}
}else{
searcher.search(result,cmd);
}
rb.setResult( result );
rsp.add("response",rb.getResults().docList);
}