【发布时间】:2012-09-30 00:40:29
【问题描述】:
我的理解是通过 Solr 索引 PDF、Word、Excel 等文档将允许搜索但不能突出显示。我有这段代码来执行索引:
String urlString = "http://localhost:8983/solr";
SolrServer solr = new HttpSolrServer(urlString);
ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");
for (MultipartFile file : files) {
if (file.getOriginalFilename().equals("")) {
continue;
}
File destFile = new File(destPath, file.getOriginalFilename());
file.transferTo(destFile);
up.addFile(destFile);
up.setParam("literal.id", destFile.getAbsolutePath());
up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
try {
solr.request(up);
} catch (SolrServerException sse) {
sse.printStackTrace();
}
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
我已阅读,为了启用突出显示,我需要“存储/解析内容?”如何才能做到这一点?感谢您的帮助。
【问题讨论】:
标签: solr highlighting apache-tika