// Ignore, the searcher might not work if index is empty.
}
}
// index the document
Indexer indexer = new Indexer(indexDirectory);
try {
indexer.open();
if (labelDoc != null) {
IndexableField existingContent = labelDoc.getField(Indexer.CONTENT_FIELD_NAME);
indexer.updateDocument(existingContent, sb.toString(), label);
} else {
indexer.addDocument(sb.toString(), label);
}
indexer.commit();
} finally {
indexer.close();
}
return true;
}