LUCENE-5222: fix expression sort with executorService

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1524575 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-09-18 21:23:38 +00:00
parent ced67903ad
commit 4d53022c49
3 changed files with 11 additions and 1 deletions

View File

@ -205,7 +205,7 @@ public class Sort {
/** Whether the relevance score is needed to sort documents. */
boolean needsScores() {
for (SortField sortField : fields) {
if (sortField.getType() == SortField.Type.SCORE) {
if (sortField.needsScores()) {
return true;
}
}

View File

@ -402,4 +402,9 @@ public class SortField {
public SortField rewrite(IndexSearcher searcher) throws IOException {
return this;
}
/** Whether the relevance score is needed to sort documents. */
public boolean needsScores() {
return type == Type.SCORE;
}
}

View File

@ -35,4 +35,9 @@ class ExpressionSortField extends SortField {
public FieldComparator<?> getComparator(final int numHits, final int sortPos) throws IOException {
return new ExpressionComparator(source, numHits);
}
@Override
public boolean needsScores() {
return true; // TODO: maybe we can optimize by "figuring this out" somehow...
}
}