Moved to prepared statements for security, using full text searching now and returning results in order of their relevance to the query.