performance improvement and fix phrase query