www.pudn.com > java_search_engineer_develop.rar > IndexManager.java
package sample.dw.paper.lucene.index;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import sample.dw.paper.lucene.util.HTMLDocParser;
/**
* This class is used to create index for html files
*
*/
public class IndexManager {
//the directory that stores html files
private final String dataDir ="D:\\×öËÑË÷ÒýÇæ\\Eclipse_projects\\Eclipse¹¤³Ì\\heritrixProject\\jobs\\1-20070629030555484\\mirror\\";
//the directory that is used to store lucene index
public final String indexDir = "D:\\indexDir";
/**
* create index
*/
public void ccreateIndex(File file ,IndexWriter indexWriter) throws IOException{
if (file.isDirectory()){
File[] files=file.listFiles();
for (int i=0;i