libraries/db: fix search query