fixed shrink bug
diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index 2f104a0..6d23202 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -1198,9 +1198,14 @@
match.internalDocID = docID;
match.populateDocument(doc, field, fieldsToLoadLocal);
- if (DEBUG)
- log.trace("I've got a match in {} of {}",
- match.getDocID(), count);
+ if (DEBUG) {
+ if (match.getDocID() != null)
+ log.trace("I've got a match in {} of {}",
+ match.getDocID(), count);
+ else
+ log.trace("I've got a match in {} of {}",
+ match.getUID(), count);
+ };
atomicMatches.add(match);
};
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/MatchModifyClassSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/MatchModifyClassSpans.java
index d6a6318..eb3ed27 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/MatchModifyClassSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/MatchModifyClassSpans.java
@@ -37,7 +37,7 @@
private final Logger log = LoggerFactory.getLogger(MatchModifyClassSpans.class);
// This advices the java compiler to ignore all loggings
- public static final boolean DEBUG = true;
+ public static final boolean DEBUG = false;
private int start = -1, end;
private int tempStart = 0, tempEnd = 0;
@@ -111,30 +111,47 @@
// Todo: Implement Divide
// Found class payload of structure <i>start<i>end<b>class
- if (payload.length == 9 && bb.get() == this.number) {
- bb.rewind();
- tempStart = bb.getInt();
- tempEnd = bb.getInt();
+ if (payload.length == 9) {
- if (DEBUG)
- log.trace("Found matching class {}-{}", tempStart, tempEnd);
+ // and classes are matches!
+ if (bb.get() == this.number) {
+ bb.rewind();
+ tempStart = bb.getInt();
+ tempEnd = bb.getInt();
- // Set start position
- if (start == -1)
- start = tempStart;
- else if (tempStart < start)
- start = tempStart;
+ if (DEBUG)
+ log.trace("Found matching class {}-{}", tempStart, tempEnd);
- // Set end position
- if (tempEnd > end)
- end = tempEnd;
+ // Set start position
+ if (start == -1)
+ start = tempStart;
+ else if (tempStart < start)
+ start = tempStart;
+
+ // Set end position
+ if (tempEnd > end)
+ end = tempEnd;
+ }
+
+ // Definately keep class information
+ else {
+ wrappedPayload.add(payload);
+ };
}
- // No class payload - but keep!
+ // No class payload
else {
- if (DEBUG)
- log.trace("Remember old payload {}", payload);
- wrappedPayload.add(payload);
+
+ // Keep as we won't shrink
+ if (start == -1) {
+ if (DEBUG)
+ log.trace("Remember old payload {}", payload);
+ wrappedPayload.add(payload);
+ }
+ else if (DEBUG) {
+ if (DEBUG)
+ log.trace("Ignore old payload {}", payload);
+ };
};
};
};
@@ -151,6 +168,16 @@
end
);
+ // Only keep class information
+ // This may change later on ...
+ for (int i = wrappedPayload.size() - 1; i >= 0; i--) {
+ if (wrappedPayload.get(i).length != 9) {
+ if (DEBUG)
+ log.trace("Forget old payload {}", wrappedPayload.get(i));
+ wrappedPayload.remove(i);
+ };
+ };
+
return true;
};
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 2ed007e..98b2947 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -12,6 +12,7 @@
#log4j.logger.de.ids_mannheim.korap.query.spans.NextSpans = TRACE, stdout
#log4j.logger.de.ids_mannheim.korap.query.spans.SimpleSpans = TRACE, stdout
#log4j.logger.de.ids_mannheim.korap.query.spans.ClassSpans = TRACE, stdout
+#log4j.logger.de.ids_mannheim.korap.query.spans.MatchModifyClassSpans = TRACE, stdout
#log4j.logger.de.ids_mannheim.korap.query.spans.MatchSpans = TRACE, stdout
# Wrapper