【Java开源代码栏目提醒】:网学会员在Java开源代码频道为大家收集整理了UndeleteIndex1.java提供大家参考,希望对大家有所帮助!
//UndeleteIndex1.java
package tianen;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.*;
import org.apache.lucene.search.*;
import org.apache.lucene.document.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import java.util.Enumeration;
public class UndeleteIndex1
{
public static void main(String[] args) throws java.io.IOException
{
String indexPath = "index";
//建立IndexReader
IndexReader ir = IndexReader.open(indexPath);
ir.undeleteAll();
System.out.println(ir.numDocs());
//关闭IndexReader
ir.close();
}
}