mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 09:00:40 +00:00
Some fixes
This commit is contained in:
@ -119,33 +119,39 @@
|
||||
if (results === null) {
|
||||
M.toast({html: 'Query has no results!'});
|
||||
} else {
|
||||
html_txt = '<table class="highlight"> <thead><tr><th>Left context</th><th>Match</th><th>Right Context</th></tr></thead>';
|
||||
console.log(results);
|
||||
html_txt = '<table class="highlight"> <thead><tr><th>Title</th><th>Left context</th><th>Match</th><th>Right Context</th></tr></thead>';
|
||||
for (let [key, hit] of Object.entries(results)) {
|
||||
var left_context = hit['context_before_cpos_list']
|
||||
var match = hit['match_cpos_list']
|
||||
var right_context = hit['context_after_cpos_list']
|
||||
var l_text = getResultInfos(left_context)
|
||||
var m_text = getResultInfos(match)
|
||||
var r_text = getResultInfos(right_context)
|
||||
html_txt += '<tr><td>' + l_text + '</td><td>' + m_text + '</td><td>' + r_text + '</td></tr>';
|
||||
var left_context = hit['left_context_cpos']
|
||||
var match = hit['match_cpos']
|
||||
var right_context = hit['right_context_cpos']
|
||||
var l_text = getResultInfos(left_context, 'word')
|
||||
var m_text = getResultInfos(match, 'word')
|
||||
var r_text = getResultInfos(right_context, 'word')
|
||||
var match_source = getResultInfos(match, 'text_title', 1)
|
||||
html_txt += '<tr> <td>' + match_source + '</td><td>' + l_text + '</td><td>' + m_text + '</td><td>' + r_text + '</td></tr>';
|
||||
l_text = '';
|
||||
m_text = '';
|
||||
}
|
||||
html_txt += '</table>';
|
||||
console.log(html_txt);
|
||||
queryResultsElement.innerHTML = html_txt;
|
||||
}
|
||||
});
|
||||
function getResultInfos(matchObject) {
|
||||
infos = '';
|
||||
for (var key in matchObject) {
|
||||
var token = matchObject[key];
|
||||
for (var key in token) {
|
||||
infos += token[key]['word'] + ' ';
|
||||
function getResultInfos(matchObject, info_key, slice) {
|
||||
var infos = [];
|
||||
for (let [infoKey, infoValue] of Object.entries(matchObject)) {
|
||||
var token = infoValue;
|
||||
for (let key in token) {
|
||||
infos.push(token[key][info_key]);
|
||||
}
|
||||
var infos = infos;
|
||||
}
|
||||
return infos
|
||||
if (slice) {
|
||||
console.log(infos);
|
||||
var infos = infos[slice];
|
||||
return infos;
|
||||
} else {
|
||||
return infos;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user