Skip to content

Commit 41a4b0f

Browse files
committed
Supply a default search limit.
1 parent 03e7924 commit 41a4b0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mavedb/routers/score_sets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ def search_score_sets(
158158
# Require a limit of at most SCORE_SET_SEARCH_MAX_LIMIT when the search query does not include publication
159159
# identifiers. We allow unlimited searches with publication identifiers, presuming that such a search will not have
160160
# excessive results.
161-
if search.publication_identifiers is None and (search.limit is None or search.limit > SCORE_SET_SEARCH_MAX_LIMIT):
161+
if search.publication_identifiers is None and search.limit is None:
162+
search.limit = SCORE_SET_SEARCH_MAX_LIMIT
163+
elif search.publication_identifiers is None and (search.limit is None or search.limit > SCORE_SET_SEARCH_MAX_LIMIT):
162164
raise HTTPException(
163165
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
164166
detail=f"Cannot search for more than {SCORE_SET_SEARCH_MAX_LIMIT} score sets at a time. Please use the offset and limit parameters to run a paginated search.",

0 commit comments

Comments
 (0)