This commit is contained in:
Patrick Jentsch 2020-04-02 14:45:02 +02:00
parent 2c93f02c11
commit 498defa386
4 changed files with 14 additions and 14 deletions

View File

@ -75,8 +75,6 @@ def pj_corpus_analysis_query(query):
progress = 0 progress = 0
client.status = 'running' client.status = 'running'
while chunk_start <= results.size: while chunk_start <= results.size:
logger.warning(client.status)
print(client.status)
if client.status == 'abort': if client.status == 'abort':
break break
chunk = results.export(context=context, cutoff=chunk_size, chunk = results.export(context=context, cutoff=chunk_size,
@ -95,9 +93,9 @@ def pj_corpus_analysis_query(query):
client.status = 'ready' client.status = 'ready'
@socketio.on('pj_inspect-match') @socketio.on('pj_corpus_analysis_inspect_match')
@socketio_login_required @socketio_login_required
def pj_corpus_analysis_query(payload): def pj_corpus_analysis_inspect_match(payload):
logger.warning(payload) logger.warning(payload)
client = pj_corpus_analysis_clients.get(request.sid) client = pj_corpus_analysis_clients.get(request.sid)
if client is None: if client is None:
@ -107,10 +105,10 @@ def pj_corpus_analysis_query(payload):
# Get more context for given match CPOS # Get more context for given match CPOS
corpus = client.corpora.get('CORPUS') corpus = client.corpora.get('CORPUS')
s = corpus.attributes.structural.get('s') s = corpus.attributes.structural.get('s')
match_context = s.export(payload["cpos"][0], payload["cpos"][1], match_context = s.export(payload['first_cpos'], payload['last_cpos'],
context=3, context=3, expand_lists=True)
expand_lists=True) socketio.emit('pj_corpus_analysis_inspect_match',
socketio.emit('pj_match_context', {"payload": match_context}, room=request.sid) {'payload': match_context}, room=request.sid)
def pj_corpus_analysis_session_handler(app, corpus_id, user_id, session_id): def pj_corpus_analysis_session_handler(app, corpus_id, user_id, session_id):

View File

@ -69,7 +69,7 @@ class CorpusAnalysisClient {
this.socket.emit("pj_corpus_analysis_init", this.corpusId); this.socket.emit("pj_corpus_analysis_init", this.corpusId);
} }
sendQuery(queryStr) { query(queryStr) {
let displayOptionsData; let displayOptionsData;
let resultListOptions; let resultListOptions;

View File

@ -82,12 +82,14 @@ function activateInspect(progress) {
} }
//gets result cpos infos for one dataIndex to send back to the server //gets result cpos infos for one dataIndex to send back to the server
function inspect(dataIndex, socket) { function inspect(dataIndex) {
// This function should be in the AnalysisClient class as a method.
console.log("Inspect!"); console.log("Inspect!");
console.log(results.resultsJSON.matches[dataIndex].c); console.log(results.resultsJSON.matches[dataIndex].c);
contextModal.open(); contextModal.open();
socket.emit("pj_inspect_match", nopaque.socket.emit("pj_corpus_analysis_inspect_match",
{"payload": {"cpos": results.resultsJSON.matches[dataIndex].c} }); {payload: {first_cpos: results.resultsJSON.matches[dataIndex].c[0],
last_cpos: results.resultsJSON.matches[dataIndex].c[1]}});
} }
function showMatchContext(payload) { function showMatchContext(payload) {
@ -254,4 +256,4 @@ function expertModeOff(tokenElements) {
tokenElement.classList.remove("expert-view"); tokenElement.classList.remove("expert-view");
tokenElement.outerHTML = tokenElement.outerHTML; // this is actually a workaround, but it works pretty fast tokenElement.outerHTML = tokenElement.outerHTML; // this is actually a workaround, but it works pretty fast
} }
} }

View File

@ -322,7 +322,7 @@
resultsList.clear(); resultsList.clear();
// Get query string and send query to server // Get query string and send query to server
let queryStr = getQueryStr(queryFormElement); let queryStr = getQueryStr(queryFormElement);
client.sendQuery(queryStr); client.query(queryStr);
}); });
// get context of one match if inspected via socket.io // get context of one match if inspected via socket.io