473,806 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1405
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.ful ltext, 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********@N O-SPAM.kingswoodw eb.net> wrote in message
news:Wu******** *************@n ews-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
2682
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 words that surround it. In other words, I want the search term highlighted and shown in an excerpt of the context in which it appears. Any suggestions or pointers? This behavior is most often seen as part of a search engine. In my case, I want...
8
2754
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 noticed that search engines don't index index.html.en but they do index index.en.html. My question is, how can I configure multiviews to deliver for example
67
6086
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 makers in the world. He gets (sic) close to $5000 per custom made flyrod. A surprising number of people buy these fishing rods and never use them....they buy them as art-like investments. He is, after all, the best there is. But if you search on...
64
6438
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 user sees is content in only one language at a time. He or she can then switch to another language and set this as the preferred language, but again he or she sees content in only this one other language. The question now is: How do I get search...
5
2549
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
12768
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. Content is "pushed" from the back via some JS, for the only displayed portion of table. Once the user scrolls, JS updates visible cells with data. It's quite the philosophy behind GMaps and similars. So, the server says to JS "update this group...
6
2643
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 the fields chosen. The first page, where they select the search fields and submit: <?php $db = mysql_connect("localhost", "root", "yeahright"); if (!$db) { die('Could not connect:'.mysql_error);
1
7555
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 having the sql statement dynamically built according to the input provided by the user. I have used the method described here hundreds of times it is quick and adaptive. I generally use a frames page for the search, in this way the search is maintained...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10617
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.