0
0
bleve/examples/beer-search/static/js/debug.js
2014-07-31 11:51:27 -04:00

37 lines
1000 B
JavaScript

function DebugCtrl($scope, $http, $routeParams, $log, $sce) {
$scope.docid = "";
$scope.maxKLen = 0;
$scope.maxVLen = 0;
$scope.debugDoc = function() {
$http.get('/api/debug/'+$scope.docid).
success(function(data) {
$scope.processResults(data);
}).
error(function(data, code) {
});
};
$scope.processResults = function(data) {
$scope.errorMessage = null;
$scope.results = data;
for(var i in $scope.results) {
row = $scope.results[i];
row.k = atob(row.key).split('');
if (row.k.length > $scope.maxKLen) {
$scope.maxKLen = row.k.length;
}
row.ki = base64DecToArr(row.key);
row.v = atob(row.val).split('');
if (row.v.length > $scope.maxVLen) {
$scope.maxVLen = row.v.length;
}
}
$scope.klentimes = new Array($scope.maxKLen);
$scope.vlentimes = new Array($scope.maxVLen);
};
}