Lucene搜索引擎封装 ExpressSearch

Apache
Java
跨平台
2010-01-05
红薯

ExpressSearch 是 ExpressMe 建站系统所用的Lucene搜索引擎的封装。

示例代码:

Searcher<Post> createSearcher() {
    SearcherImpl<Post> searcher = new SearcherImpl<Post>();
    searcher.setAnalyzer(new org.apache.lucene.analysis.standard.StandardAnalyzer());
    searcher.setDirectory(org.apache.lucene.store.FSDirectory.getDirectory("/var/search/"));
    // must be writable!
    searcher.setDocumentMapper(new DocumentMapper<Post>(Post.class));
    searcher.setFormatter(new org.apache.lucene.search.highlight.SimpleHTMLFormatter("<b>", "</b>"));
    searcher.init();
    return searcher;
}

加载中

评论(0)

暂无评论

暂无资讯

暂无问答

暂无博客

返回顶部
顶部