NewbieRob
|
Posted: 10/07/2003, 4:59 PM |
|
How can I tweak a search page so that it will search a description field for any combination of words in the search field? The basic search page is generated and works but only for the exact string entered, not for any combination of the words.
The GotoCode article, "Highlight Search Results" presents some code but the author says it should be inserted into a CodeCharge event that doesn't exist in my version, 2.1. Any ideas? I would think this capability would be great for any search page.
|
|
|
ryan
|
Posted: 10/08/2003, 12:27 AM |
|
I am visualizing your page like a movie database....
searchbox [the usual suspects]
[searchbutton]
result----------------
1-----------the usual suspects
2-----------the usual thing
searchbox [message in]
[searchbutton]
result----------------
1-----------message in a bottle
2-----------message in a cellphone
With SQL server you can enable the FULL TEXT SEARCH so any combination of words is possible
Your post 'aims two birds' search for a word combo and highlight search results. Am I right?
In your data source SQL you can use something like
SELECT *
FROM Article
WHERE Subject LIKE '%{s_Subject}%' AND ForumID = {ForumID}
ORDER BY [Position]
But rely on the table first this is a CC SQL generated already.
Next is the highlighted result usually on GRID you can
change a label's appearance on BEFORE SHOW EVENT.
Function Phrase_Article_ID_BeforeShow() 'Article_ID_BeforeShow @18-5CF986EC
'Custom Code @20-73254650
' -------------------------
' Write your own code here.
'<span style="background-color: yellow;">some text</span>
IF yourformName.labelingrid.value = CCGetParam("searchphrase") THEN
yourformName.labelingrid.value = "<span style=""background-color: " & _
"yellow;"">" & _
yourformName.labelingrid.value & _
"<span>"
END IF
'change output in CC to HTML
' -------------------------
End Function
|
|
|
|