Added doc comparison
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
index e13e54e..864f3a6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
@@ -113,16 +113,20 @@
@Override
public int compareTo(CandidateSpan o) {
- if (this.getStart() == o.getStart()){
- if (this.getEnd() == o.getEnd())
- return 0;
- if (this.getEnd() > o.getEnd() )
- return 1;
- else return -1;
+ if (this.doc == o.doc){
+ if (this.getStart() == o.getStart()){
+ if (this.getEnd() == o.getEnd())
+ return 0;
+ if (this.getEnd() > o.getEnd() )
+ return 1;
+ else return -1;
+ }
+ else if (this.getStart() < o.getStart())
+ return -1;
+ else return 1;
}
- else if (this.getStart() < o.getStart())
+ else if (this.doc < o.doc)
return -1;
- else
- return 1;
+ else return 1;
}
}