1
我试图更新lucene索引使用IndexWriter
,使用IndexWriter.deleteDocument()
和IndexWriter.updateDocument()
然而,当我提交并关闭Writer
时,更改不会反映时搜索索引,直到我停止服务是调用这些操作,有没有办法在运行时刷新/强制更改?lucene不调用操作,直到服务断开连接
我试图更新lucene索引使用IndexWriter
,使用IndexWriter.deleteDocument()
和IndexWriter.updateDocument()
然而,当我提交并关闭Writer
时,更改不会反映时搜索索引,直到我停止服务是调用这些操作,有没有办法在运行时刷新/强制更改?lucene不调用操作,直到服务断开连接
您需要重新打开您的IndexReader,请参阅DirectoryReader.openIfChanged。
这似乎并不奏效。即使在使用使'updateDocument'更改的相应编写器打开新阅读器之后,仍然无法在执行搜索时看到新文档。 – PGT