mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Avoid error if query did not yield any results.
This commit is contained in:
parent
93d7aa2170
commit
7ce0c77a73
@ -39,17 +39,18 @@ function saveQueryData(...args) {
|
|||||||
results.data.matches.push(...payload.chunk.matches);
|
results.data.matches.push(...payload.chunk.matches);
|
||||||
results.data.addData(payload.chunk.cpos_lookup, 'cpos_lookup');
|
results.data.addData(payload.chunk.cpos_lookup, 'cpos_lookup');
|
||||||
results.data.addData(payload.chunk.text_lookup, 'text_lookup');
|
results.data.addData(payload.chunk.text_lookup, 'text_lookup');
|
||||||
console.log(payload.chunk.text_lookup);
|
|
||||||
/**
|
/**
|
||||||
* Increment match_counts per text in a global results varaible because
|
* Increment match_counts per text in a global results varaible because
|
||||||
* they are coming in chunkwise.
|
* they are coming in chunkwise.
|
||||||
*/
|
*/
|
||||||
|
if (payload.chunk.text_lookup) {
|
||||||
for (let [text_key, value] of Object.entries(payload.chunk.text_lookup)) {
|
for (let [text_key, value] of Object.entries(payload.chunk.text_lookup)) {
|
||||||
if (!(text_key in results.tmp_match_counts)) {
|
if (!(text_key in results.tmp_match_counts)) {
|
||||||
results.tmp_match_counts[text_key] = {match_count: 0};
|
results.tmp_match_counts[text_key] = {match_count: 0};
|
||||||
}
|
}
|
||||||
results.tmp_match_counts[text_key].match_count += payload.chunk.text_lookup[text_key].match_count;
|
results.tmp_match_counts[text_key].match_count += payload.chunk.text_lookup[text_key].match_count;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
results.data.cpos_ranges = payload.chunk.cpos_ranges;
|
results.data.cpos_ranges = payload.chunk.cpos_ranges;
|
||||||
let queryFormElement = document.querySelector('#query-form');
|
let queryFormElement = document.querySelector('#query-form');
|
||||||
results.data.getQueryStr(queryFormElement);
|
results.data.getQueryStr(queryFormElement);
|
||||||
|
Loading…
Reference in New Issue
Block a user