From ba72802f1fb59b7d28d8cbed19856ffda0fab852 Mon Sep 17 00:00:00 2001 From: voje Date: Wed, 1 May 2019 10:30:16 +0200 Subject: [PATCH] added QUERY_LIMIT to app.py --- src/backend_flask/app.py | 5 +++-- src/frontend_vue/src/components/Frame.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend_flask/app.py b/src/backend_flask/app.py index 3f27281..f225f50 100644 --- a/src/backend_flask/app.py +++ b/src/backend_flask/app.py @@ -40,6 +40,7 @@ CORPORA = ["ssj", "kres"] app_index = None sskj_wordlist = None # used by _is_banned(hw) BANNED_HEADWORDS = ["biti"] +QUERY_LIMIT = 1000 # Some headwords contain thousands of examples - not practical for the app log = logging.getLogger(__name__) valdb = None @@ -253,7 +254,7 @@ def api_get_frames(): cur = valdb[corpus].find({"headwords": hw}) frames = [] - for ent in cur: + for ent in cur[:QUERY_LIMIT]: frames += frames_from_db_entry(ent) # pre-process this step for prod TODO # filter by relevant hw @@ -305,7 +306,7 @@ def api_get_functor_frames(): cur = valdb[corpus].find({"functors": functor}) frames = [] - for ent in cur: + for ent in cur[:QUERY_LIMIT]: frames += frames_from_db_entry(ent) # pre-process this step for prod TODO # filter by relevant functor diff --git a/src/frontend_vue/src/components/Frame.vue b/src/frontend_vue/src/components/Frame.vue index 1de33ce..e72f3c9 100644 --- a/src/frontend_vue/src/components/Frame.vue +++ b/src/frontend_vue/src/components/Frame.vue @@ -6,7 +6,7 @@
- + št. povedi: {{ frameData.sentence_count }} (prikazanih {{ frameData.sentences.length }})