// this indicates normally a hidden file so skip it
continue;
}
// retrieve file rule
LuceneIndexFileRule rule = retrieveFileRule(db, filename);
if (rule.getFileSizeLimit() == LuceneIndexFileRule.FILESIZELIMIT_INDEX_NONE) {
// skip file
continue;
}
if (rule.getFileSizeLimit() != LuceneIndexFileRule.FILESIZELIMIT_INDEX_ALL) {
int filesize = content.getFileSize(filename);
// check filesize
if (filesize > (rule.getFileSizeLimit() * 1024) || filesize == -1) {
_core.getLog().info("Skipping file " + filename + " of content " + content.getContentKey().toString() + " - filesizelimit " + rule.getFileSizeLimit() + " kb exceeded.");
// file not found or filesize exceeded limit - skip file
continue;
}
}
// try to retrieve filehandler
FileHandler handler = retrieveFileHandler(filename);
if (handler == null) {
_core.getLog().info("No filehandler found for file " + filename + " of content " + content.getContentKey().toString() + " from db " + db.getDbReference() + ".");
continue;
} else {
// parse text from file
InputStream is = content.getFileData(filename);
if (is != null) {
String text = null;
try {
handler.parse(is);
text = handler.getText();
} catch (FileHandlerException e) {
_core.getLog().error("Unable to extract text from file '" + filename + "' of content '" + content.getContentKey().toString() + "' using filehandler '" + handler.getClass().getName() + "'.", e);
}
if (text != null) {
// index file text
_core.getLog().info("Indexing file " +filename + " of content " + content.getContentKey().toString() + " from db " + db.getDbReference() + ".");
addUnStored(document, INDEXFIELD_ALLATTACHMENTS, text, rule.getBoost());
if (rule.isIncludedInAllContent()) {
addUnStored(document, INDEXFIELD_ALLCONTENT, text, rule.getBoost());
}
}
}