|
|
@ -42,10 +42,6 @@ function setup( backend, query ){ |
|
|
|
cmd.body = query_poi( req.clean ); |
|
|
|
cmd.body = query_poi( req.clean ); |
|
|
|
query_backend(cmd, callback); |
|
|
|
query_backend(cmd, callback); |
|
|
|
}, |
|
|
|
}, |
|
|
|
poi3: function(callback){ |
|
|
|
|
|
|
|
cmd.body = query_poi( req.clean, 3 ); |
|
|
|
|
|
|
|
query_backend(cmd, callback); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
poi1: function(callback){ |
|
|
|
poi1: function(callback){ |
|
|
|
cmd.body = query_poi( req.clean, 1 ); |
|
|
|
cmd.body = query_poi( req.clean, 1 ); |
|
|
|
query_backend(cmd, callback); |
|
|
|
query_backend(cmd, callback); |
|
|
@ -53,8 +49,18 @@ function setup( backend, query ){ |
|
|
|
}, |
|
|
|
}, |
|
|
|
function(err, results) { |
|
|
|
function(err, results) { |
|
|
|
// results is now equals to: {admin: docs, poi: docs, poi1: docs, poi3: docs}
|
|
|
|
// results is now equals to: {admin: docs, poi: docs, poi1: docs, poi3: docs}
|
|
|
|
var combined = results.poi.concat(results.admin).concat(results.poi1).concat(results.poi3); |
|
|
|
var combined = results.poi.splice(0,3).concat(results.admin.splice(0,4)).concat(results.poi1.splice(0,4)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dedup
|
|
|
|
|
|
|
|
var unique_ids = []; |
|
|
|
|
|
|
|
combined = combined.filter(function(item, pos) { |
|
|
|
|
|
|
|
if (unique_ids.indexOf(item.payload.id) == -1) { |
|
|
|
|
|
|
|
unique_ids.push(item.payload.id); |
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// convert docs to geojson
|
|
|
|
// convert docs to geojson
|
|
|
|
var geojson = geojsonify( combined ); |
|
|
|
var geojson = geojsonify( combined ); |
|
|
|
|
|
|
|
|
|
|
|