From 07e1305c5ea574c673ba897ee3b3fbf3d5ec3861 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 31 Mar 2007 18:48:54 +0000 Subject: Fix score comparison to favor index with fewer remainders. --- src/main/java/com/amazon/carbonado/qe/FilteringScore.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/amazon/carbonado/qe/FilteringScore.java b/src/main/java/com/amazon/carbonado/qe/FilteringScore.java index ebbb189..5655a84 100644 --- a/src/main/java/com/amazon/carbonado/qe/FilteringScore.java +++ b/src/main/java/com/amazon/carbonado/qe/FilteringScore.java @@ -788,10 +788,19 @@ public class FilteringScore { return 1; } + // Favor index which contains fewer remainders. + if (first.getRemainderCount() < second.getRemainderCount()) { + return -1; + } + if (first.getRemainderCount() > second.getRemainderCount()) { + return 1; + } + // Favor index which contains more weak matches. if (first.getWeakMatchCount() > second.getWeakMatchCount()) { return -1; - } else if (first.getWeakMatchCount() < second.getWeakMatchCount()) { + } + if (first.getWeakMatchCount() < second.getWeakMatchCount()) { return 1; } -- cgit v1.2.3