Added isReaderOpen method.
Change-Id: Ia084d1a9c75755dfb6cacb96310caa8665aab209
diff --git a/Changes b/Changes
index 5d2a9c6..68caaa5 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.58.5 2019-03-15
+0.58.5 2019-03-18
- [bugfix] Fix bug where duplicate keys occured in
field data output (diewald)
- [bugfix] Fix bug where fields already set where lifted
@@ -14,6 +14,7 @@
- [bugfix] Fixed #53 element distance query bug (margaretha)
- [bugfix] Workaround for #54 failing offsets due to
surrogate pairs (diewald)
+ - Added isReaderOpen method (margaretha)
0.58.4 2019-02-05
- [cleanup] Remove deprecated methods setLicense/getLicense,
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index 976fe86..aecbf30 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -1893,4 +1893,8 @@
mc.close();
return mc;
};
+
+ public boolean isReaderOpen () {
+ return readerOpen;
+ }
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
index b9c2320..3aeb9b9 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestKrillIndex.java
@@ -37,6 +37,7 @@
@Test
public void indexExample () throws IOException {
KrillIndex ki = new KrillIndex();
+ assertEquals(ki.isReaderOpen(), false);
assertEquals(0, ki.numberOf("base", "documents"));
assertEquals(0, ki.numberOf("base", "tokens"));
@@ -73,8 +74,10 @@
/* Save documents */
ki.commit();
+ assertEquals(ki.isReaderOpen(), false);
assertEquals(2, ki.numberOf("base", "documents"));
assertEquals(7, ki.numberOf("base", "sentences"));
+ assertEquals(ki.isReaderOpen(), true);
fd = new FieldDocument();
@@ -87,6 +90,7 @@
+ "[(4-8)s:baum|l:baum|p:NN]");
ki.addDoc(fd);
+
/* Save documents */
ki.commit();