coldfusionspecial-characterscoldfusion-9coldfusion-10cfsearch

ColdFusion cfsearch special characters


I am currently using CF11 cfsearch on our website to retrieve products. However, if the product name has ANY special characters it generates an error.

We have products that have a hash, plus, exclamation signs and some with backslashes. How do I get cfsearch to search using these special symbols?


Solution

  • I used something like this back in the day to solve <cfsearch> special character issues: https://cflib.org/udf/verityClean

    You can start with dropping this in, and then tweak the regex if you continue to see issues with other special characters. It also depends if you are using Verity/Solr/etc. to know what characters will cause issues, so you may want to look into what characters cause issues for the engine/collection you are using.