|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
最后更新时间:2007-09-21 关键字: lunene
首先下载lunen2.2 解压到F:\新建文件夹\lucene-2.2.01\文件下,然后把lucene-core-2.2.0.jar和lucene-demos-2.2.0.jar放到jdk 下设置环境变量 CLASSPATH=C:\j2sdk1.4.2_09\lib\lucene-core-2.2.0.jar;C:\j2sdk1.4.2_09\lib\lucene-demos-2.2.0.jar
设置完后,创建索引,命令:java org.apache.lucene.demo.IndexHTM L -create -index "D:\eclipse" "D:\llunece\index" 然后把luceneweb.war 放到tomcat的webapps下 把configuration.jsp中的indexLocation变量改成我自己的索引目录 String indexLocation ="D:\\llunece\\index"; 重起tomcat后,运行http://192.168.0.51:8282/luceneweb/ ,然后输入查询条件,点查询.进入results.jsp中处理.显示页面报错; Welcome to the Lucene Template application. (This is the header) ERROR opening the Index - contact sysadmin! Error message: no segments* file found in org.apache.lucene.store.FSDirectory@D:\llunece\index: files: Apache Lucene Template WebApp 1.0 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
最后更新时间:2007-09-21
知道的请解答下 谢谢 我搜索了很多次 没有找到...
|
|
| 返回顶楼 | |
|
最后更新时间:2008-05-22
[quote="linkexf"]知道的请解答下 谢谢 我搜索了很多次 没有找到...[/quote] 我也遇到同样的问题: IndexHTML.main(new String[]{"-create", "-index", "E:\\EclipseSDK\\workspace\\CoreLabView\\helpDocs\\output", "E:\\EclipseSDK\\workspace\\CoreLabView\\WEB-INF\\LuceneIndex"}); 打出的错误消息为: caught a class java.io.FileNotFoundException with message: no segments* file found in org.apache.lucene.store.FSDirectory@E:\EclipseSDK\workspace\CoreLabView\index: files: 同时它不跟我打个招呼就已经在我的Eclipse项目CoreLabView下建立了个index目录 后来我想,既然它说no segments* file found,那么我就给它个名叫segments的空文件吧,于是我手工在index下建立segments文件,它却又报 caught a class java.io.IOException with message: read past EOF 真拿它没办法。。。后来我想起JForum中有利用Lucene的,我去找了找,结果在它的WEB-INF/jforumLuceneIndex下找到3个文件: _0.cfs, segments.gen, segments_3 管它三七二十一,copy到我的index下再跑一遍,这次它说:Optimizing index... 266 total milliseconds |
|
| 返回顶楼 | |
|
最后更新时间:2008-05-21
不好意思,我也是今天刚刚看Lucene,没有仔细看Lucene的文档,其实人Lucene团队已经把文档写的很清楚了...
http://sam-ds-chen.javaeye.com/blog/195390 |
|
| 返回顶楼 | |
|
最后更新时间:2008-05-22
我仔细研读了Lucene的Demo,发现我们命令参数给错了
> ... 命令:java org.apache.lucene.demo.IndexHTML -create -index "D:\eclipse" D:\llunece\index" ... 命令不对。用法是这样的:IndexHTML [-create] [-index <index>] <root_directory> 比如 IndexHTML -create -index E:\EclipseSDK\workspace\CoreLabView\WEB-INF\LuceneIndex E:\EclipseSDK\workspace\CoreLabView\help\output 注意<index>是将要被创建的索引的保存目录,而<root_directory>则是你的数据文件所在的目录 -- 你好像弄反了。。。 |
|
| 返回顶楼 | |
浏览 823 次




