No debug flags
diff --git a/src/main/java/de/ids_mannheim/korap/analysis/MultiTermTokenStream.java b/src/main/java/de/ids_mannheim/korap/analysis/MultiTermTokenStream.java
index b3d2a6f..dd6ab1c 100644
--- a/src/main/java/de/ids_mannheim/korap/analysis/MultiTermTokenStream.java
+++ b/src/main/java/de/ids_mannheim/korap/analysis/MultiTermTokenStream.java
@@ -16,6 +16,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Reader;
import java.io.IOException;
/*
@@ -66,19 +67,24 @@
*/
public MultiTermTokenStream (String stream) {
this();
+ this._fromString(stream);
+ };
- Matcher matcher = pattern.matcher(stream);
-
- while (matcher.find()) {
-
- String[] seg = matcher.group(1).split("\\|");
- MultiTermToken mtt = new MultiTermToken( seg[0] );
-
- for (i = 1; i < seg.length; i++)
- mtt.add(seg[i]);
-
- this.addMultiTermToken(mtt);
+ /**
+ * The Constructor.
+ *
+ * @param stream The MultiTermTokenStream as a reader object.
+ */
+ public MultiTermTokenStream (Reader stream) throws IOException {
+ this();
+
+ StringBuilder sb = new StringBuilder(4096);
+ char[] buf = new char[128];
+ int i;
+ while ((i = stream.read(buf)) > 0) {
+ sb.append(buf, 0, i);
};
+ this._fromString(sb.toString());
};
@@ -283,6 +289,20 @@
return sb.toString();
};
+ private void _fromString (String stream) {
+ Matcher matcher = pattern.matcher(stream);
+
+ while (matcher.find()) {
+ String[] seg = matcher.group(1).split("\\|");
+ MultiTermToken mtt = new MultiTermToken( seg[0] );
+
+ for (i = 1; i < seg.length; i++)
+ mtt.add(seg[i]);
+
+ this.addMultiTermToken(mtt);
+ };
+ };
+
@Override
public void reset() {
this.mttIndex = 0;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
index 51e538e..deca135 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
@@ -45,7 +45,7 @@
private final static Logger log = LoggerFactory.getLogger(ElementSpans.class);
// This advices the java compiler to ignore all loggings
- public static final boolean DEBUG = true;
+ public static final boolean DEBUG = false;
/**
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
index ebc14a1..1f713bd 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
@@ -44,6 +44,7 @@
matchStartPosition= -1;
matchEndPosition= -1;
matchPayload = new LinkedList<byte[]>(); // why linkedlist?
+ // -> Can be an array as well, don't know if it comes from me or from you (ndiewald)
// Get the enumeration of the two spans to match
firstSpans = simpleSpanQuery.getFirstClause().
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
index 8bcc0eb..a41a983 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
@@ -41,7 +41,7 @@
/// cosmas20.json!!!
String json = getString(getClass().getResource("/queries/benchmark1.jsonld").getFile());
- int rounds = 10;
+ int rounds = 100;
KorapResult kr = new KorapResult();
@@ -73,6 +73,10 @@
// After refactoring
// 100 times
// 273.58114372 seconds
+
+ // After intro of attributes
+ // 100 times
+ // 350.171506379 seconds
};