mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-28 01:10:49 +01:00
Introduce NoOpIndexReader to handle missing indexes without errors (#2113)
We stumbled upon errors accessing index from plugins which were not yet initialized. To prevent this errors we use our own No-Op IndexReader for missing indices.
This commit is contained in:
@@ -173,6 +173,14 @@ class IndexManagerTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldOpenNoOpIndexReaderForMissingIndex() throws IOException {
|
||||
open(Songs.class, "idx-for-read");
|
||||
try (IndexReader reader = indexManager.openForRead(searchableType, "idx-for-read")) {
|
||||
assertThat(reader).isInstanceOf(NoOpIndexReader.class);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDoc(IndexWriter writer, String name) throws IOException {
|
||||
Document doc = new Document();
|
||||
doc.add(new TextField("hitchhiker", name, Field.Store.YES));
|
||||
|
||||
Reference in New Issue
Block a user