我试图在我的网站中实现lucene全文搜索。但我FSDirectory不支持打开(文件)方法。我得到错误方法打开(文件)是未定义的类型FSDirectory在Lucene搜索的FSDirectory中找不到open()方法
在此先感谢。
我试图在我的网站中实现lucene全文搜索。但我FSDirectory不支持打开(文件)方法。我得到错误方法打开(文件)是未定义的类型FSDirectory在Lucene搜索的FSDirectory中找不到open()方法
在此先感谢。
这里是我的代码:
尝试{
的Class.forName(JDBC_DRIVER).newInstance();
Connection conn = DriverManager.getConnection(CONNECTION_URL,USER_NAME,PASSWORD);
SimpleAnalyzer分析仪=新的SimpleAnalyzer();
IndexWriterConfig indexWriterConfig =新
IndexWriterConfig(Version.LUCENE_35,分析仪);
IndexWriter indexWriter = new IndexWriter(FSDirectory.open(indexDir),indexWriterConfig); System.out.println(“Indexing to directory'”+ indexDir +“'...”);
int indexedDocumentCount = indexer.indexDocs(indexWriter,conn);
indexWriter.close();
System.out.println(indexedDocumentCount +“records has been indexed successfully”);
}赶上(例外五){
e.printStackTrace();