take care of duplicated keywords and identifiers on query building