Delete all indices in Lucene.net

前端 未结 4 963
栀梦
栀梦 2021-01-18 02:50

I want to delete all the previously created indices. I am using Lucene.net.

I tried the following:

Term term = new Term         


        
4条回答
  •  青春惊慌失措
    2021-01-18 03:47

    From the Lucene.Net API Doc:

    public static IndexReader Open(Directory);

    Expert: Returns a read/write IndexReader reading the index in the given Directory, with a custom IndexDeletionPolicy. NOTE: Starting in 3.0 this will return a readOnly IndexReader. Throws CorruptIndexException if the index is corrupt. Throws IOException if there is a low-level IO error.

    i guess you should try

    IndexReader rdr = IndexReader.Open(_directory, true);
    

提交回复
热议问题