Added payloads segmentation info in relation spans.
Change-Id: Ie0aef877d865bc692d2627ac912007c078a8cc63
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
index 5ea240a..b9926fd 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
@@ -11,7 +11,6 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.spans.Spans;
-import org.apache.lucene.search.spans.TermSpans;
import org.apache.lucene.util.Bits;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -194,7 +193,7 @@
int i;
this.payloadTypeIdentifier = bb.get(0);
- if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_TERM.value) { // length 11
+ if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_TERM.value) {
i = bb.getInt(1);
cs.setLeftEnd(cs.start + 1);
cs.setRightStart(i);
@@ -205,11 +204,12 @@
cs.setSpanId(bb.getShort(9)); // relation id
}
}
- else if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_ELEMENT.value) { // length
- // 15
+ else if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_ELEMENT.value) {
cs.setLeftEnd(cs.start + 1);
// 1-4 start element offset
// 5-8 end element offset
+ // 9-12 start element position
+ // 13-16 end element position
cs.setRightStart(bb.getInt(9));
cs.setRightEnd(bb.getInt(13));
if (length > 17) {
@@ -218,10 +218,11 @@
cs.setSpanId(bb.getShort(21)); // relation id
}
}
- else if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT_TO_TERM.value) { // length
- // 17
+ else if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT_TO_TERM.value) {
// 1-4 start element offset
// 5-8 end element offset
+ // 9-12 end element position
+ // 13-16 end term position
cs.setEnd(bb.getInt(9));
cs.setLeftEnd(cs.end);
i = bb.getInt(13);
@@ -234,18 +235,18 @@
}
}
else if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT_TO_ELEMENT.value) {
- // 19
-
// 1-4 start left-element offset
// 5-8 end left-element offset
// 9-12 start right-element offset
// 13-16 end right-element offset
-
+ // 17-20 end left-element position
+ // 21-24 start right element position
+ // 25-28 end right element position
cs.setEnd(bb.getInt(17));
cs.setLeftEnd(cs.end);
cs.setRightStart(bb.getInt(21));
cs.setRightEnd(bb.getInt(25));
- if (length > 17) {
+ if (length > 28) {
cs.setLeftId(bb.getShort(29)); // left id
cs.setRightId(bb.getShort(31)); // right id
cs.setSpanId(bb.getShort(33)); // relation id