mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-07-14 16:33:17 +00:00
Add JSON handling with emit and on
This commit is contained in:
app
@ -5,6 +5,7 @@ from flask import current_app, request
|
||||
from flask_login import login_required
|
||||
from .CQiWrapper.CQiWrapper import CQiWrapper
|
||||
import logging
|
||||
import json
|
||||
|
||||
|
||||
'''
|
||||
@ -36,13 +37,16 @@ def recv_query(message):
|
||||
logger.warning(message)
|
||||
analysis_client = analysis_clients[request.sid]
|
||||
corpus_name = 'CORPUS'
|
||||
result_subcorpus_name = 'Query-results' # should be set by the user somehow
|
||||
result_subcorpus_name = 'Query-results'
|
||||
query = message['query']
|
||||
analysis_client.set_corpus_name(corpus_name)
|
||||
analysis_client.create_attribute_strings()
|
||||
analysis_client.query_subcorpus(result_subcorpus_name, query)
|
||||
results = analysis_client.show_results()
|
||||
logger.warning('Query results: {}'.format(str(results)))
|
||||
json_results = json.dumps(results)
|
||||
logger.warning('JSON results are {}'.format(json_results))
|
||||
socketio.emit('query_results', json_results)
|
||||
|
||||
|
||||
def observe_corpus_analysis_connection(app, corpus_id, session_id):
|
||||
|
Reference in New Issue
Block a user