mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Add match_count for texts in results.data and results.fullResultsData.
This commit is contained in:
parent
370a002af3
commit
f195b72ebd
@ -177,7 +177,6 @@ def corpus_analysis_get_match_with_full_context(payload):
|
||||
i = 0
|
||||
# Send data one match at a time.
|
||||
for index, f_cpos, l_cpos in zip(data_indexes, first_cpos, last_cpos):
|
||||
logger.warning(index)
|
||||
i += 1
|
||||
tmp_match = s.export(f_cpos, l_cpos, context=10)
|
||||
payload['matches'].append(tmp_match['matches'][0])
|
||||
|
@ -200,6 +200,12 @@ class Client {
|
||||
results[objectKey].match_count = matches.length;
|
||||
results[objectKey].cpos_ranges = results.data.cpos_ranges;
|
||||
results[objectKey].fullContext = false;
|
||||
if (objectKey === 'subResultsData') {
|
||||
// Remove match_count from texts, because they are useless in sub results
|
||||
for (let [key, value] of Object.entries(results[objectKey].text_lookup)) {
|
||||
delete results[objectKey].text_lookup[key].match_count;
|
||||
}
|
||||
}
|
||||
console.info('Results data without context has been saved.', results);
|
||||
this.isBusy = false;
|
||||
this.notifyView('results-data-recieved', {type: resultsType,
|
||||
|
@ -111,8 +111,8 @@ function saveResultsData() {
|
||||
}
|
||||
// Save incoming data. Data is incoming one match at a time.
|
||||
results[objectKey].matches.push(...payload.matches);
|
||||
results[objectKey].addData(payload.cpos_lookup, "cpos_lookup");
|
||||
results[objectKey].addData(payload.text_lookup, "text_lookup");
|
||||
results[objectKey].addData(payload.cpos_lookup, 'cpos_lookup');
|
||||
results[objectKey].addData(payload.text_lookup, 'text_lookup');
|
||||
results[objectKey].addData(results.metaData);
|
||||
results[objectKey].query = results.data.query;
|
||||
results[objectKey].corpus_type = type;
|
||||
@ -125,6 +125,10 @@ function saveResultsData() {
|
||||
progress: payload.progress})
|
||||
client.isBusy = false;
|
||||
if (payload.progress === 100) {
|
||||
if (objectKey === 'fullResultsData') {
|
||||
// Get match count per text from results.data only for fullResultsData
|
||||
results[objectKey].text_lookup = results.data.text_lookup;
|
||||
}
|
||||
client.notifyView('results-data-recieved', {type: type,
|
||||
results: results,
|
||||
fullContext: true});
|
||||
|
@ -138,8 +138,8 @@ function createFullResults(resultsList, results) {
|
||||
function createSubResults(resultsList, results) {
|
||||
resultsList.subResultsCreate.onclick = (event) => {
|
||||
let dataIndexes = [];
|
||||
resultsList.addToSubResultsIdsToShow.forEach((id) => {
|
||||
dataIndexes.push(id - 1);
|
||||
Object.keys(resultsList.subResultsIndexes).forEach((id) => {
|
||||
dataIndexes.push(id);
|
||||
});
|
||||
resultsList.subResultsCreate.querySelector('i').classList.toggle('hide');
|
||||
resultsList.subResultsCreate.innerText = 'Creating...';
|
||||
|
@ -1,83 +0,0 @@
|
||||
/**
|
||||
* HTML for showing infos about the current query or result. Also gives
|
||||
* the user the abiltiy to access the meta data for the current query or
|
||||
* result.
|
||||
*/
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = `
|
||||
|
||||
<link rel="stylesheet" href="../../static/fonts/Material_design_icons/material-icons.css">
|
||||
<link rel="stylesheet" href="../../static/css/Materialize/materialize.min.css">
|
||||
<link rel="stylesheet" href="../../static/css/nopaque.css">
|
||||
|
||||
<div class="col">
|
||||
<h6 style="margin-top: 0px;">Infos</h6>
|
||||
<div class="divider" style="margin-bottom: 10px;"></div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<button id="show-metadata"
|
||||
class="waves-effect
|
||||
waves-light
|
||||
btn-flat
|
||||
flat-interaction"
|
||||
type="submit">Corpus Metadata
|
||||
<i class="material-icons left">info_outline</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col s12">
|
||||
<p>
|
||||
<slot name="received-match-count">
|
||||
0
|
||||
</slot> of
|
||||
<slot name="match-count">(to be determined)</slot>
|
||||
matches loaded.
|
||||
<br>
|
||||
Matches occured in
|
||||
<slot name="text-lookup-count">(to be determined)</slot>
|
||||
corpus files:
|
||||
<br>
|
||||
<slot name=text-titles>(to be determined)</slot>
|
||||
</p>
|
||||
<p id="query-results-user-feedback">
|
||||
<i class="material-icons">help</i>
|
||||
The Server is still sending your results.
|
||||
Functions like "Export Results" and "Match Inspect" will be
|
||||
available after all matches have been loaded.
|
||||
</p>
|
||||
<div class="progress" id="query-progress-bar">
|
||||
<div class="determinate"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
class InfoMenu extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.appendChild(template.content.cloneNode(true));
|
||||
this.attachShadow({ mode: 'open' });
|
||||
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
||||
|
||||
}
|
||||
|
||||
// methods that will be used in connectedCallback on eventListeners
|
||||
showMetadata() {
|
||||
console.log('Show metadata somehow');
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
const showMetadataBtn = this.querySelector('#show-metadata');
|
||||
showMetadataBtn.addEventListener('click', () => this.showMetadata());
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
const showMetadataBtn = this.querySelector('#show-metadata');
|
||||
showMetadataBtn.removeEventListener();
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('info-menu', InfoMenu);
|
||||
|
||||
export { InfoMenu };
|
Loading…
Reference in New Issue
Block a user