fixing short tags on search and change to SQL