Rob Meade wrote:
Lo all,
Ok - just spotted another problem I'm going to have.
All of the rows for the page content in the database contain
formatting ie,
<b>some bold text</b>
This will cause me a problem initially as if I wanted to search for
<company name> the SQL statement
might be something like this :
WHERE PageContent Like '% company name %'
The spaces obviously prevent the word being contained within another
word (gene/generic etc) however, if there was a page that had
something like this
<b>My Company</b>
then the above would not find it.
How would I best go about ignoring the html tags within the page
content in the database, is it possible to add this to my code in my
view so that the view already has this stripped out - thus not having
to do it each time the search is carried out?
Any info appreciated..
Regards
Rob
This is one of the pitfalls of mixing data and display code (not that I
haven't done that, mind you).
One solution would be to add an OR condition:
WHERE PageContent Like '% company name %' OR
PageContent Like '%>company name<%'
But you're already using a non-sargable
(
http://www.sql-server-performance.co...nce_audit8.asp)
search condition here that is impairing your query's performance by forcing
a table scan. Adding an OR condition will simply compound that decrease in
performance.
I suspect that you will benefit from full-text indexing. I do not have any
experience with this subject, but there is a lot of information about it in
BOL. Additionally, there is a public newsgroup devoted to the topic:
..sqlserver.fulltext, which you can browse using Google, etc.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"