diff --git a/src/redturtle/volto/restapi/services/querystringsearch/get.py b/src/redturtle/volto/restapi/services/querystringsearch/get.py index fab8a8a..ac5166e 100644 --- a/src/redturtle/volto/restapi/services/querystringsearch/get.py +++ b/src/redturtle/volto/restapi/services/querystringsearch/get.py @@ -117,6 +117,9 @@ def is_event_search(self, query): """ Check if we need to perform a custom search with p.a.events method """ + if not query: + return False + indexes = [x["i"] for x in query] portal_type_check = False diff --git a/src/redturtle/volto/tests/test_advancedsearch.py b/src/redturtle/volto/tests/test_advancedsearch.py index b7ffc95..abf58c5 100644 --- a/src/redturtle/volto/tests/test_advancedsearch.py +++ b/src/redturtle/volto/tests/test_advancedsearch.py @@ -166,6 +166,10 @@ def test_search_by_not_handled_index_type_return_standard_order(self): ["f1", "d1", "e1"], [item["@id"].split("/")[-1] for item in result["items"]] ) + def test_search_no_query(self): + response = self.api_session.post("/@querystring-search") + self.assertEqual(response.status_code, 400) + def test_search_ignore_non_existent_indexes_and_return_custom_order_if_possible( self, ):