买本<征服ajax+lucene>看看就知道了,要不过几天,我在我的blog上写一个简单的例子。
解决方案 »
- 关于数组的一个问题~~
- 如何用java做HANOI塔移动演示软件
- 大家帮我出下注意 急急急.....
- 我在 myEclipse 里启动 tomcat 特别慢 但是在 tomcat 5.0\bin\startup.bat 启动就正常了 是什么原因
- spring 装载model
- 急求JSP+JAVAMAIL 带附件的完整收发邮件源代码
- 关于在开启apache以后,web.xml中url-mapping功能无法使用的问题
- 谁已经把appfuse跑起来了?能不能分享一下?
- 关于struts tiles中putlist的问题。谢谢了。
- could not resolve property: store_id of: hezeu.ord.j2ee.pojo.Remark [from hezeu.
- 如何不重起应用更新spring bean?
- 有哪位知道weblogic9.0编译jsp后生成的servlet放在哪个目录下 谢谢
/**
* 单个文件增加索引
*
* @param file 索引的文件
* @param indexDir 索引输出目录
* @throws IOException
*/
public void fileIndex(String file,String indexDir) throws IOException{
IndexWriter writer = null;
indexDir=FileUtil.dirCanUse(indexDir,outputDir);
if(indexDir==null){
return;
}
if(FileUtil.dirCanUse(file,outputDir)==null){
System.out.println("..........."+file+" not found");
return;
}
System.out.println(".......file...."+file);
//用指定的语言分析器构造一个新的写索引器(第3个参数表示是否创建新索引)
try{
writer = new IndexWriter(indexDir, analyzer, false);
}catch( IOException e){
//如果没有索引文件,则创建新索引
writer = new IndexWriter(indexDir, analyzer, true);
}
//构造包含2个字段Field的Document对象
Document doc = new Document();
//路径path字段,不索引,只存储
Field fPath = new Field("path", file,Field.Store.YES,Field.Index.NO);
doc.add(fPath);
//将文档写入索引
writer.addDocument(doc); //关闭写索引器
writer.optimize();
writer.close();
}
indexDir=FileUtil.dirCanUse(indexDir,outputDir);
if(indexDir==null){
return;
}
if(FileUtil.dirCanUse(file,outputDir)==null){
System.out.println("..........."+file+" not found");
return;
}
看了一些文章,发现似乎在安装时都要在环境变量里写两个JAR包的位置,可我下的ZIP
里面米有这两个包哦郁闷
建立索引,分词和搜索我都有了一定的了解,就是不清楚怎么和Eclipse结合,哪位大侠
帮我这只菜鸟下?
[email protected]