📄 index.java~33~
字号:
package news;
/**
* <p>Title: 新闻搜索引擎</p>
* <p>Description: 毕业设计</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author 计算机99630 沈晨
* @version 1.0
*/
import java.io.IOException;
import org.apache.lucene.analysis.cn.ChineseAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
public class Index {
IndexWriter _writer = null;
Index() throws Exception {
IndexWriter writer = new IndexWriter("c:\\test\\index",
new ChineseAnalyzer(), true);
}
/*
void AddNews(String url,String title)throws Exception {
Document _doc = new Document();
_doc.add(Field.Text("title",title));
_doc.add(Field.UnIndexed("url",url));
_writer.addDocument(_doc);
}
void close()throws Exception{
_writer.optimize();
System.out.println(_writer.docCount());
_writer.close();
}*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -