commit | 5c59230d3b08b881fb32a4bf218c524301a8b268 | [log] [tgz] |
---|---|---|
author | margaretha <margaretha@ids-mannheim.de> | Wed Nov 11 11:23:13 2015 +0100 |
committer | margaretha <margaretha@ids-mannheim.de> | Wed Nov 11 14:39:50 2015 +0100 |
tree | 45a9ca0f97e8e5bf9b4308e0df218b9ef617ba2a | |
parent | acf46c9865401022a287f733931c256bae0b4471 [diff] |
Fixed cost bug. Change-Id: Ia6c8fc60a3b07fcf709edd35e797232d87da41f0
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java index 9044c5e..8d427d7 100644 --- a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java +++ b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
@@ -125,8 +125,16 @@ @Override public long cost () { - CandidateSpan candidateSpan = candidateList.get(candidateListIndex); - return candidateSpan.getCost() + secondSpans.cost(); + if (candidateList.size() > 0) { + long cost = 0; + for (CandidateSpan candidateSpan : candidateList) { + cost += candidateSpan.getCost(); + } + return cost + secondSpans.cost(); + } + else { + return firstSpans.cost() + secondSpans.cost(); + } }