added QUERY_LIMIT to app.py

This commit is contained in:
voje 2019-05-01 10:30:16 +02:00
parent 14a6e2423b
commit ba72802f1f
2 changed files with 4 additions and 3 deletions

View File

@ -40,6 +40,7 @@ CORPORA = ["ssj", "kres"]
app_index = None app_index = None
sskj_wordlist = None # used by _is_banned(hw) sskj_wordlist = None # used by _is_banned(hw)
BANNED_HEADWORDS = ["biti"] BANNED_HEADWORDS = ["biti"]
QUERY_LIMIT = 1000 # Some headwords contain thousands of examples - not practical for the app
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
valdb = None valdb = None
@ -253,7 +254,7 @@ def api_get_frames():
cur = valdb[corpus].find({"headwords": hw}) cur = valdb[corpus].find({"headwords": hw})
frames = [] frames = []
for ent in cur: for ent in cur[:QUERY_LIMIT]:
frames += frames_from_db_entry(ent) # pre-process this step for prod TODO frames += frames_from_db_entry(ent) # pre-process this step for prod TODO
# filter by relevant hw # filter by relevant hw
@ -305,7 +306,7 @@ def api_get_functor_frames():
cur = valdb[corpus].find({"functors": functor}) cur = valdb[corpus].find({"functors": functor})
frames = [] frames = []
for ent in cur: for ent in cur[:QUERY_LIMIT]:
frames += frames_from_db_entry(ent) # pre-process this step for prod TODO frames += frames_from_db_entry(ent) # pre-process this step for prod TODO
# filter by relevant functor # filter by relevant functor

View File

@ -6,7 +6,7 @@
<div class="col-sm-7"> <div class="col-sm-7">
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<span v-if="frameData.sentences.length <= frameData.sentence_count"> <span v-if="frameData.sentences.length < frameData.sentence_count">
št. povedi: {{ frameData.sentence_count }} (prikazanih {{ frameData.sentences.length }}) št. povedi: {{ frameData.sentence_count }} (prikazanih {{ frameData.sentences.length }})
</span> </span>
<span v-else> <span v-else>