Ticket #1540 (closed defect: fixed)
Search API returns an error if empty parameters are provided
Reported by: | amercader | Owned by: | amercader |
---|---|---|---|
Priority: | major | Milestone: | ckan-sprint-2012-01-09 |
Component: | ckan | Keywords: | search |
Cc: | Repository: | ckan | |
Theme: | none |
Description
Both in 1.5.1b:
http://thedatahub.org/api/search/dataset?groups=lodcloud&title=
and 1.5.2a (current master):
http://test.ckan.net/api/search/dataset?groups=lodcloud&title=
Although the error message in 1.5.2a is more verbose:
"Bad request - Bad search option: HTTP code=400, reason=org.apache.lucene.queryParser.ParseException?: Cannot parse 'groups:lodcloud title:': Encountered \"<EOF>\" at line 1, column 22. Was expecting one of: \"(\" ... \"*\" ... <QUOTED> ... <TERM> ... <PREFIXTERM> ... <WILDTERM> ... \"[\" ... \"{\" ... <NUMBER> ..."
Some parameter validation before sending it to Solr should do the trick