Fix bugs when query contain special characters that need to be url encoded.
Clean up code.
Add url encode to filter.value (for terms panel that use filter.type == terms)