TMDM-7679 Fix incorrect query building when keywords are of empty string