Updated thread search query and ajax