backend refactoring - refactor text search function using raw MySQL (performance x 2)