}
doc = reader.document(currentDocId, relevantFields);
if (hasPayloads) {
IndexableField payload = doc.getField(payloadField);
if (payload == null) {
throw new IllegalArgumentException(payloadField + " does not exist");
} else if (payload.binaryValue() == null) {
throw new IllegalArgumentException(payloadField + " does not have binary value");
}
currentPayload = payload.binaryValue();
}
currentWeight = getWeight(currentDocId);
IndexableField fieldVal = doc.getField(field);
if (fieldVal == null) {
throw new IllegalArgumentException(field + " does not exist");
} else if(fieldVal.stringValue() == null) {
throw new IllegalArgumentException(field + " does not have string value");
}
return new BytesRef(fieldVal.stringValue());
}
return null;
}