You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
416 B
12 lines
416 B
function(head, req) {
|
|
var row, results;
|
|
results = [];
|
|
categories = (req.query.categories !== undefined ? JSON.parse(req.query.categories) : []);
|
|
while (row = getRow()) {
|
|
if (categories.length == 0 ||
|
|
categories.some(function(c) { return row.key.indexOf(c) !== -1; })) {
|
|
results.push([row.key, row.value]);
|
|
}
|
|
}
|
|
return JSON.stringify({q : req.query.categories, results : results});
|
|
}
|
|
|