关于jforum2.1.6的检索问题[转]

| No Comments | No TrackBacks

WEB开发板块中,有谈论到jforum2.1.6的中文问题,也涉及到了全文检索,这里采用lucene来实现全文检索。
具体操作方案为:
1、原来的检索是通过net.jforum.dao.generic.GenericSearchDAO来实施的,现在制作一个类net.jforum.dao.generic.GenericSearchLuceneDAO
2、net.jforum.dao.generic.GenericDataAccessDriver类中private static SearchDAO searchDao = new GenericSearchDAO();替换成private static SearchDAO searchDao = new GenericSearchLuceneDAO();从而采用GenericSearchLuceneDAO来实现检索
3、为使用cache,需要在SystemGlobals.properties文件中,对应的cacheable.objects追加net.jforum.lucene.DBForumFactory。说明net.jforum.lucene包就是我们追加的采用lucene的解决方案。
4、追加实现lucene的方案,即包net.jforum.lucene下的所有内容
:为了触发lucene,需要在net.jforum.JForum的Servlet类的init()方法中追加一行代码new DBSearchIndexer(new DBForumFactory());,以启动索引线程

基本上实现的内容就这些了,其中1、2步骤是为了保持jforum的完整性,在不破坏原有的基础上切入进去。4主要是lucene的实现方案,如果不想使用lucene来检索,可以在2的步骤中换成原有的GenericSearchDAO就可以了,同时3中的cache也要相应的去除。
这里lucene的实现中还有一些缺陷的地方,只是作为学习之用。

相关代码可下载

有关全文检索的问题,还有一种更好的实现方式compass(不过对改造jforum有些难度),以后会提及

No TrackBacks

TrackBack URL: http://www.wujianrong.com/mt-tb.cgi/1345

Leave a comment

About this Entry

This page contains a single entry by kevinwu published on November 7, 2006 8:03 PM.

Test Zoundry was the previous entry in this blog.

真人交互式搜索引擎 Ms.Dewey is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.