Tests for performance gain
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 9f39290..98bcae5 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
@@ -351,6 +351,7 @@
private void setCurrentToTemp () {
this.temp = (KorapTermSpan) this.current.clone();
+ // this.temp.copyFrom(this.current);
};
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/KorapTermSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/KorapTermSpan.java
index c1fe75e..94a528b 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/KorapTermSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/KorapTermSpan.java
@@ -44,13 +44,18 @@
};
public KorapSpan copyFrom (KorapTermSpan o) {
- super.copyFrom((KorapSpan) o);
- this.payload.put(o.payload);
+ this.start = o.start;
+ this.end = o.end;
+ this.doc = o.doc;
+ this.payload.rewind();
+ this.payload.put(o.payload.array());
return this;
};
public KorapSpan shallowCopyFrom (KorapTermSpan o) {
- super.copyFrom((KorapSpan) o);
+ this.start = o.start;
+ this.end = o.end;
+ this.doc = o.doc;
this.payload = o.payload;
return this;
};
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
index a1ffecf..23bcead 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceExclusionIndex.java
@@ -37,7 +37,7 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-0");
fd.addTV("base",
- "text",
+ "ceccdcdecd",
"[(0-1)s:c|_1#0-1|<>:s#0-1$<i>1]" +
"[(1-2)s:e|_2#1-2|<>:s#1-2$<i>2]" +
"[(2-3)s:c|_3#2-3|<>:s#2-4$<i>4]" +
@@ -55,7 +55,7 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-1");
fd.addTV("base",
- "text",
+ "eedadaeed",
"[(0-1)s:e|_1#0-1|<>:s#0-1$<i>1]" +
"[(1-2)s:e|_2#1-2|<>:s#1-2$<i>2]" +
"[(2-3)s:d|_3#2-3|<>:s#2-4$<i>4]" +
@@ -72,7 +72,7 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-");
fd.addTV("base",
- "text",
+ "dcacacdac",
"[(0-1)s:d|_1#0-1|<>:s#0-1$<i>1]" +
"[(1-2)s:c|_2#1-2|<>:s#1-2$<i>2]" +
"[(2-3)s:a|_3#2-3|<>:s#2-4$<i>4]" +
@@ -187,6 +187,7 @@
SpanQuery sq = createQuery("s","s:c","s:d",1,1,false,true);
kr = ki.search(sq, (short) 10);
+
assertEquals(3, kr.totalResults());
assertEquals(3, kr.match(2).getLocalDocID());
assertEquals(3, kr.match(2).startPos);