Recreate the index each time

This commit is contained in:
coolneng 2021-01-10 19:55:43 +01:00
parent 4e7c880b93
commit 725be7993e
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 2 additions and 2 deletions

View File

@ -66,10 +66,10 @@ public class Indexer {
return arrayObject; return arrayObject;
} }
void openIndex() throws IOException { void createIndex() throws IOException {
Directory dir = FSDirectory.open(Paths.get(folderPath)); Directory dir = FSDirectory.open(Paths.get(folderPath));
IndexWriterConfig config = new IndexWriterConfig(customAnalyzer); IndexWriterConfig config = new IndexWriterConfig(customAnalyzer);
config.setOpenMode(OpenMode.CREATE_OR_APPEND); config.setOpenMode(OpenMode.CREATE);
index = new IndexWriter(dir, config); index = new IndexWriter(dir, config);
} }