Fix PHRAS-322, add result debug informations (aggregations)

This commit is contained in:
Damien Alexandre
2014-10-14 18:51:02 +02:00
parent 3438295ca3
commit f196155049
4 changed files with 62 additions and 5 deletions

View File

@@ -472,8 +472,27 @@ function initAnswerForm() {
query = JSON.parse(query);
}
catch (e) {}
console.log('Parsed Query:', query);
console.info('All Details:', query);
console.debug('Paths:');
console.debug(query._paths);
var aggs = datas.aggregations;
try {
aggs = JSON.parse(aggs);
}
catch (e) {}
console.debug('Aggregations:');
var toDisplay = [];
_.each(aggs, function(value, key) {
_.each(value.buckets, function(bucket, keyBis) {
if (!toDisplay[keyBis]) { toDisplay[keyBis] = {}; }
toDisplay[keyBis][key] = bucket.key + ' ('+ bucket.doc_count + ')';
});
});
console.table(toDisplay);
$('#answers').empty().append(datas.results).removeClass('loading');