Added pti to classes
Change-Id: I1c4000bd3b076b40296a20d442050a6890925885
diff --git a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
index 6354f82..e963a22 100644
--- a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
+++ b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
@@ -89,6 +89,9 @@
// Analyze term value
if (ttype != 1) {
+
+ this.payload.get(); // Ignore PTI
+
if (DEBUG)
log.trace("Check {} for {}", tterm, prefixRegex.toString());
matcher = prefixRegex.matcher(tterm);
@@ -117,9 +120,12 @@
};
// for spans and relations
- if (ttype > 1)
+ if (ttype > 1) {
// Unsure if this is correct
this.endPos = this.payload.getInt() - 1;
+ };
+
+ // Ignore link id for the moment
if (ttype == 2 && this.payload.position() < lastPos) {
this.depth = this.payload.get();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
index 37036b4..f168295 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
@@ -70,7 +70,7 @@
// The highlighted payload
this.classedPayload = new ArrayList<byte[]>(3);
- this.bb = ByteBuffer.allocate(9);
+ this.bb = ByteBuffer.allocate(10);
};
@@ -147,7 +147,7 @@
// Todo: Better allocate using a Factory!
bb.clear();
- bb.putInt(spans.start()).putInt(spans.end()).put(number);
+ bb.put((byte) 0).putInt(spans.start()).putInt(spans.end()).put(number);
// Add highlight information as byte array
classedPayload.add(bb.array());
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 6ec374e..9571c8b 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
@@ -36,7 +36,7 @@
// This advices the java compiler to ignore all loggings
public static final boolean DEBUG = false;
- private byte[] b = new byte[8];
+ private byte[] b = new byte[10];
public static enum PayloadTypeIdentifier {
ELEMENT(64),
@@ -112,8 +112,9 @@
else{
this.isPayloadLoaded = true;
}
-
+
List<byte[]> payload;
+
try {
payload = (List<byte[]>) termSpans.getPayload();
}
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index f5e3e63..865cef9 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -232,9 +232,9 @@
// Todo element searches!
// Highlights!
- if (b.length == 9) {
+ if (b[0] == 0) {
bb.put(b);
- bb.rewind();
+ bb.position(1); // Ignore PTI
int start = bb.getInt();
int end = bb.getInt();
@@ -247,6 +247,7 @@
this.getEndPos());
// Ignore classes out of match range and set by the system
+ // TODO: This may be decidable by PT!!
if ((number & 0xFF) <= 128 && start >= this.getStartPos()
&& end <= this.getEndPos())
this.addHighlight(start, end - 1, number);
@@ -254,9 +255,9 @@
// Element payload for match!
// This MAY BE the correct match
- else if (b.length == 8) {
+ else if (b[0] == 64) {
bb.put(b);
- bb.rewind();
+ bb.position(1);
if (this.potentialStartPosChar == -1) {
this.potentialStartPosChar = bb.getInt(0);
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 5fed33b..d99b63c 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,4 +1,4 @@
-log4j.rootLogger = ERROR, stdout
+# log4j.rootLogger = ERROR, stdout
# Queries:
# log4j.logger.de.ids_mannheim.korap.query.SpanNextQuery = TRACE, stdout
@@ -25,10 +25,10 @@
# Responses:
# log4j.logger.de.ids_mannheim.korap.server.Node = TRACE, stdout
-# log4j.logger.de.ids_mannheim.korap.response.Match = TRACE, stdout
+log4j.logger.de.ids_mannheim.korap.response.Match = TRACE, stdout
# Index:
-# log4j.logger.de.ids_mannheim.korap.KrillIndex = TRACE, stdout
+log4j.logger.de.ids_mannheim.korap.KrillIndex = TRACE, stdout
# log4j.logger.de.ids_mannheim.korap.index.PositionsToOffset = TRACE, stdout
# log4j.logger.de.ids_mannheim.korap.index.MultiTermTokenStream = TRACE, stdout