Compare hit scores correctly
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 20 Oct 2016 09:04:16 +0000 (11:04 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 20 Oct 2016 09:04:16 +0000 (11:04 +0200)
src/main/java/net/pterodactylus/sone/web/SearchPage.java

index 5b657d5..39912d2 100644 (file)
@@ -593,7 +593,7 @@ public class SearchPage extends SoneTemplatePage {
 
                        @Override
                        public int compare(Hit<?> leftHit, Hit<?> rightHit) {
-                               return (rightHit.getScore() < leftHit.getScore()) ? -1 : ((rightHit.getScore() > leftHit.getScore()) ? 1 : 0);
+                               return Double.compare(rightHit.getScore(), leftHit.getScore());
                        }
 
                };