Pass original search query through to results page
Tweak data select statement to check for the expected data type