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
client.status = 'running'
while chunk_start <= results.size:
logger.warning(client.status)
print(client.status)
if client.status == 'abort':
break
chunk = results.export(context=context, cutoff=chunk_size,
@ -95,9 +93,9 @@ def pj_corpus_analysis_query(query):
client.status = 'ready'
@socketio.on('pj_inspect-match')
@socketio.on('pj_corpus_analysis_inspect_match')
@socketio_login_required
def pj_corpus_analysis_query(payload):
def pj_corpus_analysis_inspect_match(payload):
logger.warning(payload)
client = pj_corpus_analysis_clients.get(request.sid)
if client is None:
@ -107,10 +105,10 @@ def pj_corpus_analysis_query(payload):
# Get more context for given match CPOS
corpus = client.corpora.get('CORPUS')
s = corpus.attributes.structural.get('s')
match_context = s.export(payload["cpos"][0], payload["cpos"][1],
context=3,
expand_lists=True)
socketio.emit('pj_match_context', {"payload": match_context}, room=request.sid)
match_context = s.export(payload['first_cpos'], payload['last_cpos'],
context=3, expand_lists=True)
socketio.emit('pj_corpus_analysis_inspect_match',
{'payload': match_context}, room=request.sid)
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);
}
sendQuery(queryStr) {
query(queryStr) {
let displayOptionsData;
let resultListOptions;

View File

@ -82,12 +82,14 @@ function activateInspect(progress) {
}
//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(results.resultsJSON.matches[dataIndex].c);
contextModal.open();
socket.emit("pj_inspect_match",
{"payload": {"cpos": results.resultsJSON.matches[dataIndex].c} });
nopaque.socket.emit("pj_corpus_analysis_inspect_match",
{payload: {first_cpos: results.resultsJSON.matches[dataIndex].c[0],
last_cpos: results.resultsJSON.matches[dataIndex].c[1]}});
}
function showMatchContext(payload) {

View File

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