Fixes advanced search internal server error

Part of JIRA [OOIION-1413](https://jira.oceanobservatories.org/tasks/browse/OOIION-1413)