Skip to content

Commit

Permalink
Fixed #42 - Improved loading time of autocomplete by not loading full… (
Browse files Browse the repository at this point in the history
#43)

* Fixed #42 - Improved loading time of autocomplete by not loading full DB.

* Augmented the limit of autocomplete proposed values to 20 and used a clear Variable for that
  • Loading branch information
PonteIneptique authored Mar 27, 2018
1 parent a944b4b commit 566771d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/main/views/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from ...models import Corpus, WordToken


AUTOCOMPLETE_LIMIT = 20


@main.route('/corpus/new', methods=["POST", "GET"])
def corpus_new():
""" Register a new corpus
Expand Down Expand Up @@ -84,7 +87,7 @@ def corpus_allowed_values_api(corpus_id, allowed_type):
group_by=True,
type_like=allowed_type,
allowed_list=corpus.get_allowed_values(allowed_type=allowed_type).count() > 0
).all()
).limit(AUTOCOMPLETE_LIMIT)
if result is not None
]
)
Expand Down

0 comments on commit 566771d

Please sign in to comment.