Commit a9b99e72 authored by Romain Loth's avatar Romain Loth

api: set default number of publications shown from constants.py instead of hardcoded limit at 5

parent 265f0c27
...@@ -351,6 +351,11 @@ QUERY_SIZE_N_MAX = 1000 ...@@ -351,6 +351,11 @@ QUERY_SIZE_N_MAX = 1000
QUERY_SIZE_N_DEFAULT = 1000 QUERY_SIZE_N_DEFAULT = 1000
# ------------------------------------------------------------------------------
# Graph <=> nodes API parameters
# number of relevant publications shown
DEFAULT_N_DOCS_HAVING_NGRAM = 5
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Graph constraints to compute the graph: # Graph constraints to compute the graph:
# Modes: live graph generation, graph asynchronously computed or errors detected # Modes: live graph generation, graph asynchronously computed or errors detected
......
from gargantext.models import Node, Ngram, NodeNgram, NodeNodeNgram, NodeNode from gargantext.models import Node, Ngram, NodeNgram, NodeNodeNgram, NodeNode
from gargantext.constants import NODETYPES from gargantext.constants import NODETYPES, DEFAULT_N_DOCS_HAVING_NGRAM
from gargantext.util.db import session, delete, func, bulk_insert from gargantext.util.db import session, delete, func, bulk_insert
from gargantext.util.db_cache import cache, or_ from gargantext.util.db_cache import cache, or_
from gargantext.util.validation import validate from gargantext.util.validation import validate
...@@ -155,7 +155,7 @@ class NodeListHaving(APIView): ...@@ -155,7 +155,7 @@ class NodeListHaving(APIView):
except : except :
raise ValidationException('"ngram_ids" needs integers separated by comma.') raise ValidationException('"ngram_ids" needs integers separated by comma.')
limit=5 limit = DEFAULT_N_DOCS_HAVING_NGRAM
nodes_list = [] nodes_list = []
corpus = session.query(Node).filter(Node.id==corpus_id).first() corpus = session.query(Node).filter(Node.id==corpus_id).first()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment