}
Tracer t1 = Trace.trace("fetchRow - live docs");
Bits liveDocs = MultiFields.getLiveDocs(reader);
t1.done();
ResetableDocumentStoredFieldVisitor fieldVisitor = getFieldSelector(selector);
if (selector.isRecordOnly()) {
// select only the row for the given data or location id.
if (isFiltered(docId, reader, filter)) {
fetchResult.exists = false;
fetchResult.deleted = false;
return;
} else if (liveDocs != null && !liveDocs.get(docId)) {
fetchResult.exists = false;
fetchResult.deleted = true;
return;
} else {
fetchResult.exists = true;
fetchResult.deleted = false;
reader.document(docId, fieldVisitor);
Document document = fieldVisitor.getDocument();
if (highlightQuery != null && fieldManager != null) {
HighlightOptions highlightOptions = selector.getHighlightOptions();
String preTag = highlightOptions.getPreTag();
String postTag = highlightOptions.getPostTag();
try {
document = HighlightHelper.highlight(docId, document, highlightQuery, fieldManager, reader, preTag,
postTag);
} catch (InvalidTokenOffsetsException e) {
LOG.error("Unknown error while tring to highlight", e);
}
}
fieldVisitor.reset();
fetchResult.recordResult = getRecord(document);
return;
}
} else {
Tracer trace = Trace.trace("fetchRow - Row read");