我使用lucene在客户端进行索引和搜索,在搜索关键字后,我想在那里显示html文件。那么有没有办法存储和访问html文件呢?实际上,html文件存储的是图像和链接,它们应该作为普通html文件在java api中打开。我使用以下代码进行lucene索引
try
{
IndexWriter indexWriter = new IndexWriter(
FSDirectory.open(indexDir),
new SimpleAnalyzer(),
true,
IndexWriter.MaxFieldLength.LIMITED);
indexWriter.setUseCompoundFile(false);
indexDirectory(indexWriter, dataDir, suffix);
Document doc = new Document();
doc.add(new Field("contents", new FileReader(f)));
doc.add(new Field("filename",f.getCanonicalPath(),
Field.Store.YES,Field.Index.ANALYZED));
indexWriter.addDocument(doc);
numIndexed = indexWriter.maxDoc();
indexWriter.optimize();
indexWriter.close();
}
catch(Exception ex)
{
}如何在客户端显示符合搜索条件的html文件?
发布于 2012-10-02 04:22:57
您可能正在寻找browse(),它“启动默认浏览器以显示URI”。或者,尽管支持是limited,但也可以使用editor pane。
https://stackoverflow.com/questions/12679195
复制相似问题