Commit 749ae296 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1091: Explain significant terms

Task-Url: https://pm.winseda.de/issues/1091
parent a7ffc068
......@@ -6,9 +6,14 @@ $(document).ready(function() {
function GroupView() {
this.auth = $("#uauth").val()=='true';
this.groupId = $("#groupid").val();
this.memberCount = parseInt($("#memberCount").val());
this.setupCloud();
if (this.memberCount==0) {
return;
}
var _this = this;
this.query("queryMembers", "#group-members-container", function(data) {
$(".group-members-loading").hide();
......@@ -16,10 +21,18 @@ function GroupView() {
this.loadSignificantTerms(function(data) {
$(".significant-terms-loading").hide();
});
this.query("queryCandidates", "#group-candidates-container", function(data) {
$(".group-candidates-loading").hide();
if (data.length>0) {
$(".no-significant-terms").hide();
$("#significant-terms-table-container").show();
this.query("queryCandidates", "#group-candidates-container", function(data) {
$(".group-candidates-loading").hide();
});
} else {
$(".no-significant-terms").show();
$("#significant-terms-table-container").hide();
$(".group-candidates-loading").hide();
}
});
};
......@@ -90,12 +103,16 @@ GroupView.prototype.loadSignificantTerms = function(callback) {
type: "GET",
dataType: "json",
success: function(data) {
if (data!=null && data!=undefined && data.length>0) {
$("#significant-terms-cloud").show();
$("#termtable").css("height", (_this.options.wordcloud.height + 10) + "px");
$("#termcloud").css("height", (_this.options.wordcloud.height + 10) + "px");
_this.fillSignificantTermsCloud(data);
if (data!=null && data!=undefined) {
if (data.length>0) {
$("#significant-terms-cloud").show();
$("#termtable").css("height", (_this.options.wordcloud.height + 10) + "px");
$("#termcloud").css("height", (_this.options.wordcloud.height + 10) + "px");
_this.fillSignificantTermsCloud(data);
} else {
$("#significant-terms-cloud").hide();
$("#significant-terms-cloud").text("");
}
_this.fillSignificantTermsTable(data);
if (callback!==undefined && callback!==null) {
callback(data);
......@@ -131,24 +148,26 @@ GroupView.prototype.fillSignificantTermsCloud = function(data) {
GroupView.prototype.fillSignificantTermsTable = function(data) {
var _this = this;
$("#significant-terms-table").html("<thead>" +
"<tr>" +
"<th>Term</th>" +
"<th class=\"td-no-wrap\">Score&nbsp;<a href=\"https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_jlh_score\" target=\"_blank\">" +
"<i class=\"fa fa-question-circle\" aria-hidden=\"true\"></i></th>" +
"<th class=\"td-no-wrap\">Treffer Subset</th>" +
"<th class=\"td-no-wrap\">Treffer Superset</th>" +
"</tr>" +
"</head>" +
"<tbody></tbody>")
var tags = [];
for (var i=0; i<data.length; i++) {
$("#significant-terms-table tbody").append("<tr>" +
"<td><em>" + data[i].term + "</em></td>" +
"<th>" + (Math.round(data[i].weight * 10000) / 10000) + "</th>" +
"<td>" + data[i].count + "</td>" +
"<td>" + data[i].bgCount + "</td>" +
"</tr>")
}
if (data.length>0) {
$("#significant-terms-table").html("<thead>" +
"<tr>" +
"<th>Term</th>" +
"<th class=\"td-no-wrap\">Score&nbsp;<a href=\"https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_jlh_score\" target=\"_blank\">" +
"<i class=\"fa fa-question-circle\" aria-hidden=\"true\"></i></th>" +
"<th class=\"td-no-wrap\">Treffer Subset</th>" +
"<th class=\"td-no-wrap\">Treffer Superset</th>" +
"</tr>" +
"</head>" +
"<tbody></tbody>")
var tags = [];
for (var i=0; i<data.length; i++) {
$("#significant-terms-table tbody").append("<tr>" +
"<td><em>" + data[i].term + "</em></td>" +
"<th>" + (Math.round(data[i].weight * 10000) / 10000) + "</th>" +
"<td>" + data[i].count + "</td>" +
"<td>" + data[i].bgCount + "</td>" +
"</tr>")
}
}
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment