Browse Source

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

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

5
controller/suggest.js

@ -48,8 +48,9 @@ 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 = [];

Loading…
Cancel
Save