Do not allow empty queries
Fix SQL for metadata selection
Perform new search when metadata selection is changed