Rollback version
diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index bfd6c94..8d5b93d 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -154,7 +154,7 @@
{
Properties prop = new Properties();
- URL file = getClass().getClassLoader().getResource("index.properties");
+ URL file = getClass().getResource("/index.properties");
if (file != null) {
String f = file.getFile();
diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndexer.java b/src/main/java/de/ids_mannheim/korap/KorapIndexer.java
new file mode 100644
index 0000000..b935db8
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndexer.java
@@ -0,0 +1,86 @@
+package de.ids_mannheim.korap;
+import java.util.*;
+import java.io.*;
+import org.apache.lucene.store.MMapDirectory;
+import de.ids_mannheim.korap.KorapIndex;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KorapIndexer {
+ KorapIndex index;
+ String indexDir;
+ int count;
+ int commitCount;
+
+ // Init logger
+ private final static Logger log = LoggerFactory.getLogger(KorapIndexer.class);
+
+ public KorapIndexer(Properties prop) throws IOException {
+ this.indexDir = prop.getProperty("lucene.indexDir");
+
+ System.out.println("Index to " + this.indexDir);
+
+ String commitCount = prop.getProperty("lucene.index.commit.count", "1000");
+
+ this.index = new KorapIndex(new MMapDirectory(new File(indexDir)));
+ this.count = 0;
+ this.commitCount = Integer.parseInt(commitCount);
+ };
+
+
+ public void parse (File dir) {
+ for (String file : dir.list()) {
+ if (file.matches("^[^\\.].+?\\.json\\.gz$")) {
+ String found = dir.getPath() + '/' + file;
+ System.out.print(" Index " + found + " ... ");
+ if (this.index.addDocFile(found, true) == null) {
+ System.out.println("fail.");
+ continue;
+ };
+ System.out.println("done (" + count + ").");
+ this.count++;
+
+ if ((this.count % this.commitCount) == 0)
+ this.commit();
+ };
+ };
+ };
+
+
+ public void commit () {
+ System.out.println("-----");
+ System.out.print(" Commit ... ");
+ try {
+ this.index.commit();
+ }
+ catch (IOException e) {
+ System.err.println("Unable to commit to index " + this.indexDir);
+ };
+ System.out.println("done.");
+ };
+
+
+
+ public static void main (String[] argv) throws IOException {
+ Properties prop = new Properties();
+ InputStream fr = new FileInputStream(argv[0]);
+ prop.load(fr);
+ KorapIndexer ki = new KorapIndexer(prop);
+ System.out.println();
+
+ for (String arg : Arrays.copyOfRange(argv, 1, argv.length)) {
+ File f = new File(arg);
+ if (f.isDirectory())
+ ki.parse(f);
+ };
+
+
+ // Final commit
+ ki.commit();
+
+ // Finish indexing
+ System.out.println("-----");
+ System.out.println(" Indexed " + ki.count + " files.");
+ System.out.println();
+ };
+};
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/KorapLongSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/KorapLongSpan.java
index 96df20c..26a1367 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/KorapLongSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/KorapLongSpan.java
@@ -1,5 +1,7 @@
package de.ids_mannheim.korap.query.spans;
+import de.ids_mannheim.korap.query.spans.KorapSpan;
+
import java.util.Collection;
public class KorapLongSpan extends KorapSpan {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
index 92eab68..56724b4 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/WithinSpans.java
@@ -1013,9 +1013,9 @@
* this method may not be called at all for performance reasons. An ordered
* SpanQuery does not lazy load, so if you have payloads in your index and
* you do not want ordered SpanNearQuerys to collect payloads, you can
- * disable VCollection with a constructor option.<br>
+ * disable collection with a constructor option.<br>
* <br>
- * Note that the return type is a VCollection, thus the ordering should not be relied upon.
+ * Note that the return type is a collection, thus the ordering should not be relied upon.
* <br/>
* @lucene.experimental
*
diff --git a/src/main/java/de/ids_mannheim/korap/util/KorapArray.java b/src/main/java/de/ids_mannheim/korap/util/KorapArray.java
index f4f336c..62d1b8c 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KorapArray.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KorapArray.java
@@ -5,7 +5,7 @@
/**
* @author Nils Diewald
*
- * A VCollection of Array specific utilities for the Korap project.
+ * A collection of Array specific utilities for the Korap project.
*/
public class KorapArray {
diff --git a/src/main/java/de/ids_mannheim/korap/util/KorapByte.java b/src/main/java/de/ids_mannheim/korap/util/KorapByte.java
index 898a100..9115ba7 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KorapByte.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KorapByte.java
@@ -7,7 +7,7 @@
/**
* @author Nils Diewald
*
- * A VCollection of methods to deal with Bytes and Byte arrays.
+ * A collection of methods to deal with Bytes and Byte arrays.
*/
public class KorapByte {
diff --git a/src/main/java/de/ids_mannheim/korap/util/KorapHTML.java b/src/main/java/de/ids_mannheim/korap/util/KorapHTML.java
index 456d0a1..cadbb11 100644
--- a/src/main/java/de/ids_mannheim/korap/util/KorapHTML.java
+++ b/src/main/java/de/ids_mannheim/korap/util/KorapHTML.java
@@ -3,7 +3,7 @@
/**
* @author Nils Diewald
*
- * A VCollection of methods to deal with Bytes and Byte arrays.
+ * A collection of methods to deal with Bytes and Byte arrays.
*/
public class KorapHTML {
diff --git a/src/main/resources/korap.conf b/src/main/resources/korap.conf
deleted file mode 100644
index 1e1002f..0000000
--- a/src/main/resources/korap.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-# Lucene Backend properties
-lucene.properties = true
-lucene.index = /data/indices
-lucene.index.commit.count = 134217000
-lucene.index.commit.log = log/korap.commit.log
-
-# Not active at the moment:
-lucene.index.search.count.default = 25
-lucene.index.search.count.max = 100
-lucene.index.search.context.left.type = token
-lucene.index.search.context.left.default = 6
-lucene.index.search.context.left.max = 12
-lucene.index.search.context.right.type = token
-lucene.index.search.context.right.default = 6
-lucene.index.search.context.right.max = 12
diff --git a/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java b/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
index 2dc1c58..3fa1ea9 100644
--- a/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
+++ b/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
@@ -1,265 +1,263 @@
-import de.ids_mannheim.korap.*;
+import java.io.*;
+
+import de.ids_mannheim.korap.KorapIndex;
import de.ids_mannheim.korap.index.FieldDocument;
+import de.ids_mannheim.korap.KorapCollection;
+import de.ids_mannheim.korap.KorapFilter;
+import de.ids_mannheim.korap.KorapResult;
+import de.ids_mannheim.korap.KorapQuery;
+import de.ids_mannheim.korap.filter.BooleanFilter;
+
+
import org.apache.lucene.index.Term;
+import org.apache.lucene.search.spans.SpanOrQuery;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.search.spans.SpanQuery;
+
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-
@RunWith(JUnit4.class)
public class TestKorapCollection {
@Test
- public void filterExample() throws IOException {
-
- // Construct index
- KorapIndex ki = new KorapIndex();
- // Indexing test files
- for (String i : new String[]{"00001", "00002", "00003", "00004", "00005", "00006", "02439"}) {
- ki.addDocFile(
- getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
+ public void filterExample () throws IOException {
+
+ // Construct index
+ KorapIndex ki = new KorapIndex();
+ // Indexing test files
+ for (String i : new String[] {"00001", "00002", "00003", "00004", "00005", "00006", "02439"}) {
+ ki.addDocFile(
+ getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
);
- }
- ;
- ki.commit();
+ };
+ ki.commit();
- KorapFilter kf = new KorapFilter();
+ KorapFilter kf = new KorapFilter();
- // Create Virtual collections:
- KorapCollection kc = new KorapCollection(ki);
+ // Create Virtual collections:
+ KorapCollection kc = new KorapCollection(ki);
- assertEquals("Documents", 7, kc.numberOf("documents"));
+ assertEquals("Documents", 7, kc.numberOf("documents"));
- // The virtual collection consists of all documents that have
- // the textClass "reisen" and "freizeit"
+ // The virtual collection consists of all documents that have
+ // the textClass "reisen" and "freizeit"
- kc.filter(kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung"));
+ kc.filter( kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung") );
- assertEquals("Documents", 5, kc.numberOf("documents"));
- assertEquals("Tokens", 1678, kc.numberOf("tokens"));
- assertEquals("Sentences", 194, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 5, kc.numberOf("documents"));
+ assertEquals("Tokens", 1678, kc.numberOf("tokens"));
+ assertEquals("Sentences", 194, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
- // Subset this to all documents that have also the text
- kc.filter(kf.and("textClass", "kultur"));
+ // Subset this to all documents that have also the text
+ kc.filter(kf.and("textClass", "kultur"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 1, kc.numberOf("documents"));
+ assertEquals("Tokens", 405, kc.numberOf("tokens"));
+ assertEquals("Sentences", 75, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
- kc.filter(kf.and("corpusID", "WPD"));
+ kc.filter(kf.and("corpusID", "WPD"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 1, kc.numberOf("documents"));
+ assertEquals("Tokens", 405, kc.numberOf("tokens"));
+ assertEquals("Sentences", 75, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
- // Create a query
- KorapQuery kq = new KorapQuery("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+ // Create a query
+ KorapQuery kq = new KorapQuery("tokens");
+ SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
- KorapResult kr = kc.search(query);
- assertEquals(70, kr.totalResults());
+ KorapResult kr = kc.search(query);
+ assertEquals(70, kr.totalResults());
- kc.extend(kf.and("textClass", "uninteresting"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
+ kc.extend( kf.and("textClass", "uninteresting") );
+ assertEquals("Documents", 1, kc.numberOf("documents"));
- kc.extend(kf.and("textClass", "wissenschaft"));
+ kc.extend( kf.and("textClass", "wissenschaft") );
- assertEquals("Documents", 3, kc.numberOf("documents"));
- assertEquals("Tokens", 1669, kc.numberOf("tokens"));
- assertEquals("Sentences", 188, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
- // System.err.println(kr.toJSON());
- }
-
- ;
+ assertEquals("Documents", 3, kc.numberOf("documents"));
+ assertEquals("Tokens", 1669, kc.numberOf("tokens"));
+ assertEquals("Sentences", 188, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
+ // System.err.println(kr.toJSON());
+ };
@Test
- public void filterExampleAtomic() throws IOException {
+ public void filterExampleAtomic () throws IOException {
+
+ // That's exactly the same test class, but with multiple atomic indices
- // That's exactly the same test class, but with multiple atomic indices
-
- // Construct index
- KorapIndex ki = new KorapIndex();
- // Indexing test files
- for (String i : new String[]{"00001",
- "00002",
- "00003",
- "00004",
- "00005",
- "00006",
- "02439"}) {
- ki.addDocFile(
- getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
+ // Construct index
+ KorapIndex ki = new KorapIndex();
+ // Indexing test files
+ for (String i : new String[] {"00001",
+ "00002",
+ "00003",
+ "00004",
+ "00005",
+ "00006",
+ "02439"}) {
+ ki.addDocFile(
+ getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
);
- ki.commit();
- }
- ;
+ ki.commit();
+ };
- KorapFilter kf = new KorapFilter();
+ KorapFilter kf = new KorapFilter();
- // Create Virtual collections:
- KorapCollection kc = new KorapCollection(ki);
+ // Create Virtual collections:
+ KorapCollection kc = new KorapCollection(ki);
- assertEquals("Documents", 7, kc.numberOf("documents"));
+ assertEquals("Documents", 7, kc.numberOf("documents"));
- // If this is set - everything is fine automatically ...
- kc.filter(kf.and("corpusID", "WPD"));
- assertEquals("Documents", 7, kc.numberOf("documents"));
+ // If this is set - everything is fine automatically ...
+ kc.filter(kf.and("corpusID", "WPD"));
+ assertEquals("Documents", 7, kc.numberOf("documents"));
- // The virtual collection consists of all documents that have the textClass "reisen" and "freizeit"
+ // The virtual collection consists of all documents that have the textClass "reisen" and "freizeit"
- kc.filter(kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung"));
+ kc.filter( kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung") );
- assertEquals("Documents", 5, kc.numberOf("documents"));
- assertEquals("Tokens", 1678, kc.numberOf("tokens"));
- assertEquals("Sentences", 194, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 5, kc.numberOf("documents"));
+ assertEquals("Tokens", 1678, kc.numberOf("tokens"));
+ assertEquals("Sentences", 194, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 139, kc.numberOf("paragraphs"));
- // Subset this to all documents that have also the text
- kc.filter(kf.and("textClass", "kultur"));
+ // Subset this to all documents that have also the text
+ kc.filter(kf.and("textClass", "kultur"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 1, kc.numberOf("documents"));
+ assertEquals("Tokens", 405, kc.numberOf("tokens"));
+ assertEquals("Sentences", 75, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
- // This is already filtered though ...
- kc.filter(kf.and("corpusID", "WPD"));
+ // This is already filtered though ...
+ kc.filter(kf.and("corpusID", "WPD"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 405, kc.numberOf("tokens"));
- assertEquals("Sentences", 75, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 1, kc.numberOf("documents"));
+ assertEquals("Tokens", 405, kc.numberOf("tokens"));
+ assertEquals("Sentences", 75, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 48, kc.numberOf("paragraphs"));
- // Create a query
- KorapQuery kq = new KorapQuery("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+ // Create a query
+ KorapQuery kq = new KorapQuery("tokens");
+ SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
- KorapResult kr = kc.search(query);
- assertEquals(70, kr.totalResults());
+ KorapResult kr = kc.search(query);
+ assertEquals(70, kr.totalResults());
- kc.extend(kf.and("textClass", "uninteresting"));
- assertEquals("Documents", 1, kc.numberOf("documents"));
+ kc.extend( kf.and("textClass", "uninteresting") );
+ assertEquals("Documents", 1, kc.numberOf("documents"));
- kc.extend(kf.and("textClass", "wissenschaft"));
+ kc.extend( kf.and("textClass", "wissenschaft") );
- assertEquals("Documents", 3, kc.numberOf("documents"));
- assertEquals("Tokens", 1669, kc.numberOf("tokens"));
- assertEquals("Sentences", 188, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
- }
+ assertEquals("Documents", 3, kc.numberOf("documents"));
+ assertEquals("Tokens", 1669, kc.numberOf("tokens"));
+ assertEquals("Sentences", 188, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 130, kc.numberOf("paragraphs"));
+ };
- ;
@Test
- public void filterExample2() throws IOException {
-
- // Construct index
- KorapIndex ki = new KorapIndex();
- // Indexing test files
- for (String i : new String[]{"00001",
- "00002",
- "00003",
- "00004",
- "00005",
- "00006",
- "02439"}) {
- ki.addDocFile(
- getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
+ public void filterExample2 () throws IOException {
+
+ // Construct index
+ KorapIndex ki = new KorapIndex();
+ // Indexing test files
+ for (String i : new String[] {"00001",
+ "00002",
+ "00003",
+ "00004",
+ "00005",
+ "00006",
+ "02439"}) {
+ ki.addDocFile(
+ getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
);
- }
- ;
- ki.commit();
+ };
+ ki.commit();
- ki.addDocFile(getClass().getResource("/wiki/AUG-55286.json.gz").getFile(), true);
+ ki.addDocFile(getClass().getResource("/wiki/AUG-55286.json.gz").getFile(), true);
- ki.commit();
+ ki.commit();
- KorapFilter kf = new KorapFilter();
+ KorapFilter kf = new KorapFilter();
- // Create Virtual collections:
- KorapCollection kc = new KorapCollection(ki);
- kc.filter(kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung"));
- assertEquals("Documents", 6, kc.numberOf("documents"));
- assertEquals("Tokens", 2089, kc.numberOf("tokens"));
- assertEquals("Sentences", 234, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 141, kc.numberOf("paragraphs"));
+ // Create Virtual collections:
+ KorapCollection kc = new KorapCollection(ki);
+ kc.filter( kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung") );
+ assertEquals("Documents", 6, kc.numberOf("documents"));
+ assertEquals("Tokens", 2089, kc.numberOf("tokens"));
+ assertEquals("Sentences", 234, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 141, kc.numberOf("paragraphs"));
- kc.filter(kf.and("corpusID", "A00"));
+ kc.filter( kf.and("corpusID", "A00") );
- assertEquals("Documents", 1, kc.numberOf("documents"));
- assertEquals("Tokens", 411, kc.numberOf("tokens"));
- assertEquals("Sentences", 40, kc.numberOf("sentences"));
- assertEquals("Paragraphs", 2, kc.numberOf("paragraphs"));
+ assertEquals("Documents", 1, kc.numberOf("documents"));
+ assertEquals("Tokens", 411, kc.numberOf("tokens"));
+ assertEquals("Sentences", 40, kc.numberOf("sentences"));
+ assertEquals("Paragraphs", 2, kc.numberOf("paragraphs"));
- // Create a query
- KorapQuery kq = new KorapQuery("tokens");
- SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
+ // Create a query
+ KorapQuery kq = new KorapQuery("tokens");
+ SpanQuery query = kq.seg("opennlp/p:NN").with("tt/p:NN").toQuery();
- KorapResult kr = kc.search(query);
+ KorapResult kr = kc.search(query);
- assertEquals(87, kr.totalResults());
- // System.out.println(kr.toJSON());
- }
-
- ;
+ assertEquals(87, kr.totalResults());
+ // System.out.println(kr.toJSON());
+ };
@Test
- public void uidCollection() throws IOException {
+ public void uidCollection () throws IOException {
+
+ // Construct index
+ KorapIndex ki = new KorapIndex();
+ // Indexing test files
+ int uid = 1;
+ for (String i : new String[] {"00001",
+ "00002",
+ "00003",
+ "00004",
+ "00005",
+ "00006",
+ "02439"}) {
+ FieldDocument fd = ki.addDocFile(
+ uid++,
+ getClass().getResource("/wiki/" + i + ".json.gz").getFile(),
+ true
+ );
+ };
+ ki.commit();
- // Construct index
- KorapIndex ki = new KorapIndex();
- // Indexing test files
- int uid = 1;
- for (String i : new String[]{"00001",
- "00002",
- "00003",
- "00004",
- "00005",
- "00006",
- "02439"}) {
- FieldDocument fd = ki.addDocFile(
- uid++,
- getClass().getResource("/wiki/" + i + ".json.gz").getFile(),
- true
- );
- }
- ;
- ki.commit();
+ assertEquals("Documents", 7, ki.numberOf("documents"));
+ assertEquals("Paragraphs", 174, ki.numberOf("paragraphs"));
+ assertEquals("Sentences", 281, ki.numberOf("sentences"));
+ assertEquals("Tokens", 2661, ki.numberOf("tokens"));
- assertEquals("Documents", 7, ki.numberOf("documents"));
- assertEquals("Paragraphs", 174, ki.numberOf("paragraphs"));
- assertEquals("Sentences", 281, ki.numberOf("sentences"));
- assertEquals("Tokens", 2661, ki.numberOf("tokens"));
+ SpanQuery sq = new SpanTermQuery(new Term("tokens", "s:der"));
+ KorapResult kr = ki.search(sq, (short) 10);
+ assertEquals(86,kr.getTotalResults());
- SpanQuery sq = new SpanTermQuery(new Term("tokens", "s:der"));
- KorapResult kr = ki.search(sq, (short) 10);
- assertEquals(86, kr.getTotalResults());
+ // Create Virtual collections:
+ KorapCollection kc = new KorapCollection();
+ kc.filterUIDs(new String[]{"2", "3", "4"});
+ kc.setIndex(ki);
+ assertEquals("Documents", 3, kc.numberOf("documents"));
- // Create Virtual collections:
- KorapCollection kc = new KorapCollection();
- kc.filterUIDs(new String[]{"2", "3", "4"});
- kc.setIndex(ki);
- assertEquals("Documents", 3, kc.numberOf("documents"));
+ assertEquals("Paragraphs", 46, kc.numberOf("paragraphs"));
+ assertEquals("Sentences", 103, kc.numberOf("sentences"));
+ assertEquals("Tokens", 1229, kc.numberOf("tokens"));
- assertEquals("Paragraphs", 46, kc.numberOf("paragraphs"));
- assertEquals("Sentences", 103, kc.numberOf("sentences"));
- assertEquals("Tokens", 1229, kc.numberOf("tokens"));
-
- kr = kc.search(sq);
- assertEquals(39, kr.getTotalResults());
- }
-
- ;
+ kr = kc.search(sq);
+ assertEquals(39,kr.getTotalResults());
+ };
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
index d28f36f..74a827b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRealIndex.java
@@ -47,7 +47,7 @@
// Construct filter generator
KorapFilter kf = new KorapFilter();
- // The virtual VCollection consists of all documents that have
+ // The virtual collection consists of all documents that have
// the textClasses "reisen" and "freizeit"
// kc.filter( kf.and("textClass", "reisen").and("textClass", "freizeit-unterhaltung") );