String indexName = (String) rb.req.getContext().get("solandra-index");
if (indexName == null)
throw new IOException("Missing core name");
IndexReader reader = (IndexReader) ((SolrIndexReader) rb.req.getSearcher().getIndexReader()).getWrappedReader();
reader.setIndexName(indexName);
if(flushCache(indexName))
reader.reopen();
return false;
}
String indexName = (String) rb.req.getContext().get("solandra-index");
if (indexName == null || indexName.equals(""))
{
return false; //
}
else
{
if(logger.isDebugEnabled())
logger.debug("core: " + indexName);
}
if (rb.shards == null)
{
// find number of shards
long docId = IndexManagerService.instance.getMaxId(indexName);
int numShards = CassandraIndexManager.getShardFromDocId(docId);
//run local
if(numShards == 0) {
IndexReader reader = (IndexReader) ((SolrIndexReader) rb.req.getSearcher().getIndexReader())
.getWrappedReader();
String subIndex = indexName+"~0";
reader.setIndexName(subIndex);
if(flushCache(subIndex))
{
reader.reopen();
}
return false;
}
// assign shards