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

(cherry picked from commit bbf524360d24b9e3f8004296daa2845c36e4fa1d)