int startRecord = query.getFilter().getStartRecord();
boolean returnIdsOnly = Val.chkBool(Val.chkStr(request.getParameter("returnIdsOnly")), false);
if (returnIdsOnly) {
startRecord = 1;
query.getFilter().setMaxRecords(1);
LuceneQueryAdapter tmp = new LuceneQueryAdapter();
tmp.execute(context, query);
query.getFilter().setMaxRecords(query.getResult().getNumberOfHits());
}
query.getFilter().setStartRecord(startRecord);
LuceneQueryAdapter lqa = new LuceneQueryAdapter() {
@Override
protected void onRecord(DiscoveredRecord record, Document document) {
Map<String, List<String>> fieldMap = new HashMap<String, List<String>>();
for (Fieldable field : document.getFields()) {
String name = field.name();
List<String> fieldValues = fieldMap.get(name);
if (fieldValues == null) {
fieldValues = new ArrayList<String>();
fieldMap.put(name, fieldValues);
}
fieldValues.add(field.stringValue());
}
mapping.put(record, fieldMap);
}
};
lqa.execute(context, query);
startRecord += query.getFilter().getMaxRecords();
loadLuceneMeta(context, fields);
OpenSearchProperties osProps = new OpenSearchProperties();