Add a constraint to forward secondspans
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
index a4e9919..3880215 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SegmentSpans.java
@@ -9,6 +9,7 @@
import org.apache.lucene.util.Bits;
import de.ids_mannheim.korap.query.SimpleSpanQuery;
+import de.ids_mannheim.korap.query.SpanSegmentQuery;
/** SegmentSpans is an enumeration of Span matches, which ensures that two spans
* have exactly the same start and end positions.
@@ -17,19 +18,19 @@
* */
public class SegmentSpans extends SimpleSpans {
- public SegmentSpans (SimpleSpanQuery simpleSpanQuery,
+ public SegmentSpans (SpanSegmentQuery spanSegmentQuery,
AtomicReaderContext context,
Bits acceptDocs,
Map<Term,TermContext> termContexts) throws IOException {
- this(simpleSpanQuery, context, acceptDocs, termContexts, true);
+ this(spanSegmentQuery, context, acceptDocs, termContexts, true);
}
- public SegmentSpans (SimpleSpanQuery simpleSpanQuery,
+ public SegmentSpans (SpanSegmentQuery spanSegmentQuery,
AtomicReaderContext context,
Bits acceptDocs,
Map<Term,TermContext> termContexts,
boolean collectPayloads) throws IOException {
- super(simpleSpanQuery, context, acceptDocs, termContexts,collectPayloads);
+ super(spanSegmentQuery, context, acceptDocs, termContexts,collectPayloads);
}
/** Check weather the start and end positions of the current
@@ -44,7 +45,8 @@
matchEndPosition = firstSpans.end();
return 0;
}
- else if (firstSpans.start() < secondSpans.start())
+ else if (firstSpans.start() < secondSpans.start() ||
+ firstSpans.end() < secondSpans.end())
return -1;
return 1;