mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 09:30:40 +00:00
Work on new list bilding
This commit is contained in:
@ -310,15 +310,14 @@
|
||||
innerWindow: 8,
|
||||
outerWindow: 1
|
||||
}],
|
||||
valueNames: ["titles", "lc", "hit", "rc"],
|
||||
valueNames: ["titles", "lc", "hit", "rc", {data: ["index"]}],
|
||||
item: `<tr>
|
||||
<td class="titles"></td>
|
||||
<td class="lc"></td>
|
||||
<td class="hit"></td>
|
||||
<td class="rc"></td>
|
||||
</tr>`};
|
||||
resultList = new List('result-list', options);
|
||||
|
||||
resultList = new ResultList('result-list', options);
|
||||
});
|
||||
|
||||
|
||||
@ -326,14 +325,14 @@
|
||||
nopaque.socket.on("corpus_analysis_query", function(response) {
|
||||
// ERROR code checking
|
||||
if (response["code"] === 0) {
|
||||
console.log("[ERROR] corpus_analysis_init");
|
||||
console.log("[SUCCESS] corpus_analysis_init");
|
||||
console.log("Code:" + response["code"]);
|
||||
// further code execution of this code block starting in line 342
|
||||
} else if (response["code"] === 1) {
|
||||
queryResultsTableElement.classList.add("hide");
|
||||
queryLoadingElement.classList.add("hide");
|
||||
nopaque.toast("Invalid query entered!", "red");
|
||||
console.log("[SUCCESS] corpus_analysis_init");
|
||||
console.log("[ERROR] corpus_analysis_init");
|
||||
console.log("Code:" + response["code"]);
|
||||
return; // no further code execution of this code block
|
||||
} else {
|
||||
@ -369,40 +368,29 @@
|
||||
// List building/appending the chunks when query had results
|
||||
// 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.
|
||||
// TODO: count_corpus_files müssen aus full results genommen werden. Ist am Ende richtig aber dazwischen zählt es hoch
|
||||
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");
|
||||
|
||||
var toAdd = [];
|
||||
var resultItems = []; // list for holding every row item
|
||||
// get infos for full match row
|
||||
for (let [index, match] of chunk["matches"].entries()) {
|
||||
lc_tokens = "";
|
||||
for (cpos of match["lc"]) {
|
||||
word = chunk["cpos_lookup"][cpos]["word"];
|
||||
lc_tokens += " " + word;
|
||||
}
|
||||
// console.log(lc_tokens);
|
||||
hit_tokens = "";
|
||||
for (cpos of match["hit"]) {
|
||||
word = chunk["cpos_lookup"][cpos]["word"];
|
||||
hit_tokens += " " + word;
|
||||
}
|
||||
// console.log(hit_tokens);
|
||||
rc_tokens = "";
|
||||
for (cpos of match["rc"]) {
|
||||
word = chunk["cpos_lookup"][cpos]["word"];
|
||||
rc_tokens += " " + word;
|
||||
}
|
||||
// console.log(rc_tokens);
|
||||
item = { titles: "test", lc: lc_tokens, hit: hit_tokens, rc: rc_tokens };
|
||||
toAdd.push(item);
|
||||
resultItems.push({...match, ...{"index": index}});
|
||||
}
|
||||
resultList.add(resultItems, items => {
|
||||
for (let item of items) {
|
||||
item.elm = resultList.createResultRowElement(item);}
|
||||
});
|
||||
resultList.update();
|
||||
});
|
||||
|
||||
// inspect match functions
|
||||
function inspect() {
|
||||
console.log("Inspect!")
|
||||
}
|
||||
resultList.add(toAdd, function(toAdd) {console.log('All '
|
||||
+ toAdd.length
|
||||
+ ' results were added!')});
|
||||
});
|
||||
|
||||
// Function to download data to a file
|
||||
function download(downloadElem, data, filename, type) {
|
||||
|
Reference in New Issue
Block a user