improve search a tiny bit by using SQL queries