Fixed search query creation