日期:2014-05-18 浏览次数:20794 次
import lia.meetlucene.*;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String keyword = request.getParameter("keywords");
String dataPath = "L:\\My Documents\\Courses\\IR\\exp\\data_shakespeare";
String indexPath = "L:\\My Documents\\Courses\\IR\\exp\\index_shakespeare";
String[] toIndexer = { indexPath, dataPath };
String[] toSearcher = { indexPath, keyword };
try {
Indexer.main(toIndexer);//这里报错
Searcher.main(toSearcher);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
package com.xnch.lucenesearch.internet;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.miscellaneous.LimitTokenCountAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.Tex