Summary[] summaries = results.getSummaries();
for (int i = 0; i < details.length; i++) {
// every document has an indexno and an indexdocno
JSONObject result = new JSONObject();
HitDetails detail = details[i];
Hit hit = hits[i];
result.accumulate("indexno", hit.getIndexNo());
result.accumulate("indexkey", hit.getUniqueKey());
// don't add summaries not including summaries
if (summaries != null && results.isWithSummary()) {
Summary summary = summaries[i];
result.accumulate("summary", summary.toString());
}
// add the fields from hit details
JSONObject fields = new JSONObject();
for (int k = 0; k < detail.getLength(); k++) {
String name = detail.getField(k);
String[] values = detail.getValues(name);
// if we specified fields to return, only return those fields
if (fieldSet.size() == 0 || fieldSet.contains(name)) {
JSONArray valuesAr = new JSONArray();
for (int m = 0; m < values.length; m++) {