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 {
if (liveDocs != null && !liveDocs.get(docId)) {
fetchResult.exists = false;
fetchResult.deleted = true;
return;
} else {
fetchResult.exists = true;
fetchResult.deleted = false;
String rowId = getRowId(reader, docId);
Term term = new Term(ROW_ID, rowId);
if (returnIdsOnly) {
int recordCount = BlurUtil.countDocuments(reader, term);
fetchResult.rowResult = new FetchRowResult();
fetchResult.rowResult.row = new Row(rowId, null, recordCount);
} else {
List<Document> docs;
if (highlightQuery != null && fieldManager != null) {
HighlightOptions highlightOptions = selector.getHighlightOptions();
String preTag = highlightOptions.getPreTag();
String postTag = highlightOptions.getPostTag();
docs = HighlightHelper.highlightDocuments(reader, term, fieldVisitor, selector, highlightQuery,
fieldManager, preTag, postTag);
} else {
docs = BlurUtil.fetchDocuments(reader, term, fieldVisitor, selector, maxHeap, table + "/" + shard);
}