原来你的库非常庞大啊.你可以用addDocument(); 其实,lucene里面删除索引与添加是一样快你试试! 你写个servlet检查定时自动更新 然后一次读出所有未索引的数据批量更新索引org.apache.lucene.index.IndexWriter有常数可以设置: int mergeFactor:决定当你addDocument()时是否要同以前的合并的频率,其直与内存有关
1、 用lucene/jsp/servlet做检索系统,根据文章名、作者、等几个信息查询文章所有信息出来。lucene里只有根据一个字段查询的例子QueryParser.parse(key,column,StopAnalyzer());能不能实现根据几个字段进行查询呢 ?请问怎么实现? ==================哪一个例子?我连它的web demo(luceneweb)都用不了,不知怎么做?============================================================================= Welcome to the Lucene Template application. (This is the header) ERROR opening the Index - contact sysadmin!While parsing query: C:\opt\lucene\index\segments (~ 0殑圅) Jakarta Lucene Template WebApp 1.0
那位可以帮忙?
lucene里有Query query = QueryParser.parse(string1,string2,new ChineseAnalyzer())
的方法,谁知道 string1&string2都代表什么意思?在lucene的例子里有(queryString,"body",new analyzer()),难道string1代表了一条sql语句?不可能吧?请高手不吝赐教!多谢!
string2代表你建立索引的字段名!(filed)
public synchronized int insert() throws SQLException {
int count = 0;
while (rows.hasNext()) {
DataBean thisForm = (DataBean) rows.next();
thisForm.setKeyInt(allocateKey());
Map thisMap = thisForm.toMap();
//插入到数据库
Data.articleInsert((String) thisMap.get("article"),
(String) thisMap.get("contributor"),
(String) thisMap.get("creator"),
(String) thisMap.get("title"),
(String) thisMap.get("content"));
//插入到索引(同时更新)
SeachEgine.IndexInsert((String) thisMap.get("article"),
(String) thisMap.get("contributor"),
(String) thisMap.get("creator"),
(String) thisMap.get("title"),
(String) thisMap.get("content"));
count++;
}
return count;
}
//删除你建立的索引;
IndexDelete();
//重建你的索引;
IndexCreate();
} 其实你只要调用建立索引,Lucene会自动删除以前建立的索引,然后重建索引
我现在开始考虑lucene的可行性了,据说oracle自己有全文搜索引擎,但是对中文切分词作得不好,难道要自己写中文切份吗?天啊!
其实,lucene里面删除索引与添加是一样快你试试!
你写个servlet检查定时自动更新
然后一次读出所有未索引的数据批量更新索引org.apache.lucene.index.IndexWriter有常数可以设置:
int mergeFactor:决定当你addDocument()时是否要同以前的合并的频率,其直与内存有关
==================哪一个例子?我连它的web demo(luceneweb)都用不了,不知怎么做?=============================================================================
Welcome to the Lucene Template application. (This is the header) ERROR opening the Index - contact sysadmin!While parsing query: C:\opt\lucene\index\segments (~ 0殑圅)
Jakarta Lucene Template WebApp 1.0