473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Search (part 2) - content/html

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
Jul 19 '05 #1
4 1387
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"
Jul 19 '05 #2
"Bob Barrows" wrote ...
This is one of the pitfalls of mixing data and display code (not that I
haven't done that, mind you).
Is there another way using a web based content management system to apply
html codes to specific words without doing this though Bob? If so, let me
know as I've not previously thought of other ways etc, any info on that
appreciated.
One solution would be to add an OR condition:

WHERE PageContent Like '% company name %' OR
PageContent Like '%>company name<%'
Hadn't thought of that, I already am using OR where they have an any word
search etc, so that could be added I guess, obviously be needed per word
that they enter as criteria.
But you're already using a non-sargable
non-sargable?
(http://www.sql-server-performance.co...nce_audit8.asp)
cheers, just having a read now - still dont know what sargable means, but I
get the idea about the indexes (none being used at this time).
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.


Cheers, will check it out..

What are your thoughts to this idea....

If I were to add a seperate table for non-formatted data, ie, the user
updates a pages content, it writes the info once to a table with no
formatting, and another with the formatting, the one with is used for
display etc, the one without for searching - removing the < > problem....I
appreciate this probably sounds some what goofy, and would obviously
increase the size of the database, it might not be as slick as other
solutions, but I'm guessing it would work....

Downside would be getting the existing 100+ pages into the new table without
any formatting!

Regards

Rob
Jul 19 '05 #3
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in message
news:Wu*********************@news-text.cableinet.net...
"Bob Barrows" wrote ...
But you're already using a non-sargable
non-sargable?

(http://www.sql-server-performance.co...nce_audit8.asp
)
cheers, just having a read now - still dont know what sargable means, but I get the idea about the indexes (none being used at this time).


Here's a definition for sargable:
http://www.sql-server-performance.co...y.asp#Sargable

The word is derived from the phrase Search-ARGument-ABLE.
http://manuals.sybase.com/onlinebook...TextView/26460

HTH
-Chris Hohmann
Jul 19 '05 #4
"Chris Hohmann" wrote ...
Here's a definition for sargable:
http://www.sql-server-performance.co...y.asp#Sargable

The word is derived from the phrase Search-ARGument-ABLE.

http://manuals.sybase.com/onlinebook...TextView/26460

Thanks for that Chris, its not just a made up word then :o)

Regards

Rob
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
8
by: Stromboli | last post by:
Hi, I have my site available in a couple of languages most of the files are indexf.html (french), indexi.html (italian) and indexde.html (german).. I'd like to start using multiviews but I've...
67
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod...
64
by: Manfred Kooistra | last post by:
I am building a website with identical content in four different languages. On a first visit, the search engine determines the language of the content by the IP address of the visitor. What the...
5
by: GilBGilB | last post by:
Hello My problem is this Window 1: newWin = window.open("http://1.1.1.1/....","winName",...); This opens a new window from a server function displayResp(obj) { var x = obj.var1;
4
by: Claudio Calboni | last post by:
Hello folks, I'm having some performance issues with the client-side part of my application. Basically, it renders a huge HTML table (about 20'000 cells in my testing scenario), without content....
6
by: jej1216 | last post by:
I am trying to put together a PHP search page in which the user can select none, one, two, or three fields to search, and then the results php will build the SQL with dynamic where caluses to reflect...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.