// Read the terms
if (!fieldsToReadSet.isEmpty()) {
try {
TermEnum termEnum = indexReader.terms();
while (termEnum.next()) {
Term term = termEnum.term();
String field = term.field();
if (fieldsToReadSet.contains(field)) {
// This is a value of a wanted field
ArrayList valueList = (ArrayList) resultMap.get(field);
valueList.add(term.text());
}
}
} catch (IOException exc) {
throw new RegainException("Reading terms from index failed", exc);
}