Create query normalization function.