Skip to content

Commit

Permalink
Fix issue #1260 - Fuzzy query crashes when switch to a different page…
Browse files Browse the repository at this point in the history
… in returned result
  • Loading branch information
robinshine committed Mar 9, 2023
1 parent 4a8e127 commit b12e6ae
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.onedev.server.search.entitytext;

import edu.emory.mathcs.backport.java.util.Collections;
import io.onedev.commons.utils.ExceptionUtils;
import io.onedev.commons.utils.FileUtils;
import io.onedev.commons.utils.WordUtils;
Expand Down Expand Up @@ -451,16 +450,10 @@ public Map<Long, Float> call() throws Exception {
}

List<Long> entityIds = new ArrayList<>(entityScores.keySet());
Collections.sort(entityIds, new Comparator<>() {

@Override
public int compare(Object o1, Object o2) {
if (entityScores.get(o1) < entityScores.get(o2))
return 1;
else
return -1;
}

Collections.sort(entityIds, (o1, o2) -> {
Float score1 = entityScores.get(o1);
Float score2 = entityScores.get(o2);
return Float.compare(score1, score2) * -1;
});

if (firstResult < entityIds.size()) {
Expand Down

0 comments on commit b12e6ae

Please sign in to comment.