mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 09:30:40 +00:00
Rename some stuff
This commit is contained in:
@ -266,7 +266,7 @@
|
||||
;
|
||||
// create some global variables
|
||||
var hitsPerPage;
|
||||
var full_results;
|
||||
var result;
|
||||
var resultList;
|
||||
|
||||
// Get query form element and save its data on submit and send this data via
|
||||
@ -283,12 +283,12 @@
|
||||
// full results object declaration, kind of global maybe store it later?
|
||||
// will always be reset if a query is sent, so that only the chunks of the
|
||||
// current query will be saved in it
|
||||
full_results = {};
|
||||
full_results["matches"] = [];
|
||||
full_results["cpos_lookup"] = {};
|
||||
full_results["text_lookup"] = {};
|
||||
full_results["total_nr_matches"] = 0;
|
||||
full_results["query"] = "";
|
||||
result = {};
|
||||
result["matches"] = [];
|
||||
result["cpos_lookup"] = {};
|
||||
result["text_lookup"] = {};
|
||||
result["match_count"] = 0;
|
||||
result["query"] = "";
|
||||
// some hiding/showing for loading animation
|
||||
queryLoadingElement.classList.remove("hide");
|
||||
queryResultsTableElement.classList.add("hide");
|
||||
@ -318,19 +318,20 @@
|
||||
|
||||
|
||||
// socket.on triggered when result chunks are recieved
|
||||
nopaque.socket.on("corpus_analysis", function(chunk) {
|
||||
nopaque.socket.on("corpus_analysis", function(response) {
|
||||
// logs the current recieved chunk
|
||||
chunk = response["result"];
|
||||
console.log("### corpus_analysis chunk ###");
|
||||
console.log(chunk);
|
||||
// logs and extends/push/update the current recieved chunk to the
|
||||
// full_results Object
|
||||
console.log("### corpus analysis updated full_results json ###");
|
||||
full_results["matches"].push(...chunk["matches"]);
|
||||
Object.assign(full_results["cpos_lookup"], chunk["cpos_lookup"]);
|
||||
Object.assign(full_results["text_lookup"], chunk["text_lookup"]);
|
||||
full_results["total_nr_matches"] = chunk["total_nr_matches"];
|
||||
full_results["query"] = chunk["query"];
|
||||
console.log(full_results);
|
||||
// result Object
|
||||
console.log("### corpus analysis updated result json ###");
|
||||
result["matches"].push(...chunk["matches"]);
|
||||
Object.assign(result["cpos_lookup"], chunk["cpos_lookup"]);
|
||||
Object.assign(result["text_lookup"], chunk["text_lookup"]);
|
||||
result["match_count"] = chunk["match_count"];
|
||||
result["query"] = chunk["query"];
|
||||
console.log(result);
|
||||
// Some hiding and showing of loading animations
|
||||
queryLoadingElement.classList.add("hide");
|
||||
queryResultsTableElement.classList.remove("hide");
|
||||
@ -352,9 +353,9 @@
|
||||
// write metadata query information into HTML elements
|
||||
// like nr. of all matches in how many files etc.
|
||||
// TODO: count_corpus_files müssen aus full results genommen werden.
|
||||
total_nr_matches = chunk["total_nr_matches"];
|
||||
let count_corpus_files = Object.keys(chunk["text_lookup"]).length;
|
||||
queryResultsMetadataElement.innerHTML = chunk["total_nr_matches"] + " matches in " + count_corpus_files + " corpus files.";
|
||||
match_count = chunk["match_count"];
|
||||
let count_corpus_files = Object.keys(result["text_lookup"]).length;
|
||||
queryResultsMetadataElement.innerHTML = chunk["match_count"] + " matches in " + count_corpus_files + " corpus files.";
|
||||
queryResultsMetadataElement.appendChild(exportQueryResults);
|
||||
exportQueryResults.classList.remove("hide");
|
||||
|
||||
@ -381,7 +382,9 @@
|
||||
item = { titles: "test", lc: lc_tokens, hit: hit_tokens, rc: rc_tokens };
|
||||
toAdd.push(item);
|
||||
}
|
||||
resultList.add(toAdd, function(toAdd) {console.log('All ' + toAdd.length + 'results were added!')});
|
||||
resultList.add(toAdd, function(toAdd) {console.log('All '
|
||||
+ toAdd.length
|
||||
+ ' results were added!')});
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user