Have you considered setting up a separate table for these searches? MySQL full-text searches only work with MyISAM tables, so you probably don't want to mix full-text searches with important data (unless, of course, you have a strange aversion to foreign keys and referential integrity).
The approach I used in the past is basically this:
- Set up a separate table with a simple structure (id, search_text).
id matches the id of what you are looking for.search_text is everything (the main text, title, author’s name, etc.) that you want to find in one block of text.
- Add full text indexing to the lookup table.
- Refresh the database update process to build the corresponding
search_text string as plain text; this is where you could cross out HTML and possibly apply some other mappings (for example, extend things like "A +" to find a full text search). - When you search, you apply the same mappings that apply to the data available for search, and then go to the lookup table for matches.
This solves your HTML problem, allows you to easily search more than the HTML content, and allows you to customize your search results by weighing the various components of the search text with repetition (for example, if you want the tags to be more important than the body of the text, just add tags two or three times when creating search_text ).
You need to process the text to remove or ignore the HTML. This approach allows you to do this only once, rather than doing it with every search.
mu is too short
source share