davisp commented on a change in pull request #469: Choose index based on fields match URL: https://github.com/apache/couchdb/pull/469#discussion_r109705681
########## File path: src/mango/src/mango_cursor_view.erl ########## @@ -135,14 +139,16 @@ composite_prefix([Col | Rest], Ranges) -> % reduce view read on each index with the ranges to find % the one that has the fewest number of rows or something. choose_best_index(_DbName, IndexRanges) -> - Cmp = fun({A1, A2}, {B1, B2}) -> - case length(A2) - length(B2) of + Cmp = fun({IdxA, PrefixA, ScoreA}, {IdxB, PrefixB, ScoreB}) -> + case length(PrefixA) - length(PrefixB) of N when N < 0 -> true; N when N == 0 -> % This is a really bad sort and will end % up preferring indices based on the % (dbname, ddocid, view_name) triple Review comment: You'll want to remove this comment since its no longer relevant. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services