Mercurial Hosting > luan
diff src/goodjava/lucene/logging/LoggingIndexWriter.java @ 1528:3bd4d7963456
use goodjava/lucene/api
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 26 Jul 2020 23:11:53 -0600 |
parents | 31b543826ca9 |
children | 634f6765830e |
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/LoggingIndexWriter.java Sun Jul 26 15:06:15 2020 -0600 +++ b/src/goodjava/lucene/logging/LoggingIndexWriter.java Sun Jul 26 23:11:53 2020 -0600 @@ -17,6 +17,7 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; +import org.apache.lucene.index.LiveIndexWriterConfig; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.MatchAllDocsQuery; @@ -78,6 +79,14 @@ newLogs(); } + public Directory getDirectory() { + return indexWriter.getDirectory(); + } + + public LiveIndexWriterConfig getLuceneConfig() { + return indexWriter.getLuceneConfig(); + } + private void setLog() throws IOException { if( log != null ) log.close(); @@ -180,7 +189,7 @@ if( dirFile.exists() ) throw new RuntimeException(); Directory dir = FSDirectory.open(dirFile); - LuceneIndexWriter mergeWriter = new LuceneIndexWriter( indexWriter.luceneVersion, dir, indexWriter.goodConfig ); + LuceneIndexWriter mergeWriter = new LuceneIndexWriter( dir, indexWriter.goodConfig ); playLog( first.input(), mergeWriter ); playLog( second.input(), mergeWriter ); mergeWriter.commit(); @@ -251,7 +260,7 @@ File dirFile = new File(logDir,"check"); IoUtils.deleteRecursively(dirFile); Directory dir = FSDirectory.open(dirFile); - LuceneIndexWriter checkWriter = new LuceneIndexWriter( indexWriter.luceneVersion, dir, indexWriter.goodConfig ); + LuceneIndexWriter checkWriter = new LuceneIndexWriter( dir, indexWriter.goodConfig ); playLogs(logReaders,checkWriter); logger.info("check lucene"); IndexReader checkReader = checkWriter.openReader();