Skip to content

Commit

Permalink
enables collections keyword as standalone searchable param
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Sep 20, 2023
1 parent daa8874 commit 0412f40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions SearchAPI/SearchQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ def can_use_cmr(self):

def check_has_search_params(self):
non_searchable_param = ['output', 'maxresults', 'pagesize', 'maturity']
list_param_exceptions = ['collections']
list_param_exceptions = ['collections'] # allows collections in granule/product search

params = [v.lower() for v in self.request.local_values]
is_collection_search = 'collections' in params

searchables = [
v for v in self.request.local_values if v.lower() not in [*non_searchable_param, *list_param_exceptions]
v for v in params if v not in [*non_searchable_param, *list_param_exceptions]
]

if len(searchables) <= 0:
if len(searchables) <= 0 and not is_collection_search:
raise ValueError(
'No searchable parameters specified, queries must include'
' parameters besides output= and maxresults='
Expand Down

0 comments on commit 0412f40

Please sign in to comment.