initCore("solrconfig.xml","schema11.xml");
}
private String getStringVal(SolrQueryRequest sqr, String field, int doc) throws IOException {
SchemaField sf = sqr.getSchema().getField(field);
ValueSource vs = sf.getType().getValueSource(sf, null);
Map context = ValueSource.newContext();
vs.createWeight(context, sqr.getSearcher());
SolrIndexReader sr = sqr.getSearcher().getReader();
int idx = SolrIndexReader.readerIndex(doc, sr.getLeafOffsets());
int base = sr.getLeafOffsets()[idx];
SolrIndexReader sub = sr.getLeafReaders()[idx];
DocValues vals = vs.getValues(context, sub);
return vals.strVal(doc-base);
}