使用lucene建立索引的问题

zhangbo198294 2006-02-17 11:17:12
IndexFiles indexFiles=new IndexFiles();
File file = new File(request.getRealPath("1"));
IndexWriter writer= new IndexWriter(request.getRealPath("myindex"), new StandardAnalyzer(), true);
indexFiles.addIndex(writer,file);
writer.optimize();
writer.close();

我每次尽力新索引的时候会覆盖掉旧的索引库但覆盖时就出错了?_r.cfs我自己手动删也删不掉除非把TOMCAT关闭才可以删 索引库应该是被Lock 请问怎么解锁?
java.io.IOException: Cannot delete _r.cfs
at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:144)
at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:105
)
at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:83)

at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:173)
at essp.SearcheServlet.doGet(SearcheServlet.java:75)
at essp.SearcheServlet.doPost(SearcheServlet.java:110)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:204)
...全文
203 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
javadesigner 2006-06-30
  • 打赏
  • 举报
回复
最后一个true方法就是普通索引
false就是增量索引
不一样的 ~
如果不想覆盖第三个参数就用false
chg2008 2006-05-25
  • 打赏
  • 举报
回复
要使用增量索引

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧