Browse Source

equal distribution (mostly equal to the size requested or less)

msv2
Harish Krishna 10 years ago
parent
commit
81c064308f
  1. 7
      controller/suggest.js

7
controller/suggest.js

@ -48,9 +48,10 @@ function setup( backend, query ){
} }
}, },
function(err, results) { function(err, results) {
// results is now equals to: {admin: docs, poi: docs, poi1: docs, poi3: docs} var splice_length = req.clean.size / 3;
var combined = results.poi.splice(0,3).concat(results.admin.splice(0,4)).concat(results.poi1.splice(0,4)); // results is now equals to: {admin: docs, poi: docs, poi1: docs}
var combined = results.poi.splice(0,splice_length).concat(results.admin.splice(0,splice_length)).concat(results.poi1.splice(0,splice_length));
//dedup //dedup
var unique_ids = []; var unique_ids = [];
combined = combined.filter(function(item, pos) { combined = combined.filter(function(item, pos) {

Loading…
Cancel
Save