• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 399
  • Last Modified:

MySQL Coldfusion search?

I'm using Coldfusion and MySQL for searching data. A rich text editor has been used to setup subscripts and superscripts so my data might look like this in one field 8<sub>2</sub>9 and so on. Now if I had a user wanting to find all value of 829 how could this be done without recognizing the tags to subscript the text? It's just that no results come up for 829 but they do if I type 8<sub>2</sub>9

2 Solutions
If you want the user to "get what you typed", perhaps it's simpler to have the same Rich Text Editor (RTE) for entering the search term. So the if the user enters 8<sub>2</sub>9 (of course, with help from your RTE), that's what he would get.
Most of the times it's not a very feasible option to have an RTE as the search-box, but you are the best judge for your app.

Another option, if you don't want to use RTE for inputting search terms, is to have duplicate columns for all searchable fields that contain html tags. While inserting the records, strip off all the html tags and query these "sanitized" fields for matching search terms.

Neither solution is elegant, but the end users don't care ;-)
One solution could be remove the <sub> and </sub> on the fly while you run the SQL query.
Here is an example.


That might help.

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now