Skip to content

Commit

Permalink
Reversed sorting by code length for search to most-specific-first (cl…
Browse files Browse the repository at this point in the history
…oses #23)
  • Loading branch information
migurski committed Oct 5, 2013
1 parent d3cddb5 commit ddbaafc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routes/api/v0/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports.get = function ( req, res ) {
}

// Sort with highest-scored items first.
items.sort(function(a, b) { return (results[b.code] - b.code.toString().length*2) - (results[a.code] - a.code.toString().length*2) });
items.sort(function(a, b) { return (results[b.code] + b.code.toString().length*2) - (results[a.code] + a.code.toString().length*2) });

// Send JSON to client
res.send(items);
Expand Down

0 comments on commit ddbaafc

Please sign in to comment.