Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kwilliams
194 Posts |
Posted - 2003-10-13 : 17:34:16
|
| Hello there,QuickFacts: ASP, JavaScript, SQL Server 2k, Win2k (for dbo.Commission_Minutes)I have two questions about some searchable pages that I've created for by DB table called dbo.Commission_Minutes. I received these questions from my boss, and I'm hoping to give him a quick estimate of how long it would take to complete these tasks. Here they are:1) The user has 3 options on the search page (see http://www.douglas-county.com/Local_Govt/minutes.asp) to search for what's called "Minutes", including searching using keywords with a full-index search. I know how to display the beginning of the Minute using the "substring" method, but how can I display a Minute starting around where the keyword is, like Google's search? (see example under question #2)2) How can I bold only the keyword in each Minute that's on the results page?EXAMPLE:Here's an example of what I'm talking about using "Minute" as keyword:...here is the Minute. It contains information for the date of 12/30/2002. Not much happened in this meeting. Attendees included: Me...Any and all help is appreciated. Thanks. |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-10-14 : 02:41:43
|
I dont have time to give you some code, but here is a summary of what you need to do:On the submit page, use the Split function (split by space) to create an array of keywords. Then when you retrive the search results (presumably into a string variable), iterate through the array and use the Replace function to replace all occurance of each keyword within the text returned with <b></b> tags around it. You can use the Substring function on that text variable to return the relevant snippet.Owais Make it idiot proof and someone will make a better idiot |
 |
|
|
kwilliams
194 Posts |
Posted - 2003-10-14 : 09:23:42
|
Owais,Thanks for the instructions. I went through DMXZone.com after I made the post in this forum, and actually found a tutorial with the same instructions at http://www.dmxzone.com/ShowDetail.asp?NewsId=1604. He referenced 4guysfromrolla.com for this tutorial. Thanks for yoru suggestions. I will look at them along with this tutorial for the solution to bolding the keyword in the results.But I still haven't found a solution to the other request:quote: 1) The user has 3 options on the search page (see http://www.douglas-county.com/Local_Govt/minutes.asp) to search for what's called "Minutes", including searching using keywords with a full-index search. I know how to display the beginning of the Minute using the "substring" method, but how can I display a Minute starting around where the keyword is, like Google's search? (see example under question #2)
I think that it involves using a substring, but I'm not sure of how to do this. If you or anyone knows the answer, that would be extremely helpful. Thanks.KWilliams |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-10-14 : 09:28:52
|
Something like this:var foo = "It is such a beautiful day!";var pos = foo.indexOf("beautiful");Response.Write foo.substring(pos, 15);Owais Make it idiot proof and someone will make a better idiot |
 |
|
|
kwilliams
194 Posts |
Posted - 2003-10-14 : 09:35:48
|
| Ok, thanks Owais. I'll give them both a try today. I really appreciate your help.KWilliams |
 |
|
|
|
|
|
|
|