info@kearnytech.com
-
10/9/2007 7:59:41 AM
RE:Customizing search inputs
I don't know that this is the best approach, but here is what I did to achieve similar functionality. This approach does require an in-dept knowledge of a developer in ASP.NET.
1. I had to create my own Custom Search Provider whose primary job is to take the parameters passed in the Search method of the ISearchProvider interface and call a custom Stored Procedure to perform the actual search. 2. I also create a custom Search Dialog Web Parts whose job is to collect the input from the user, create a querystring and call the result page with my custom Search Result Web Part (next point). 3. Next, I created a custom Search Result Web Part whose job is to collect the input from the querystring, create an appropriate WhereCondition and then used the CMSSSearchResult control to preform the search and display the results (setting the WhereCondition using the one created by the input from the querystring). 4. Finally I added my web parts to my search dialog and result pages.
As they say the Devil is in the details in this case.
Some things to lookout for:
1. Becareful of SQL injection attacks. 2. I found that in Kentico 2.2 I had to include the keyword (searchtext) in the criteria otherwise the interface would not perform the search. I have not chaecked to determine if this is still true with verison 2.3. When the user does not enter a keyword I simply pass searchtech='' in my querystring.
There is a lot more to this aproach then what can easily be detailed here, so I hope this will at least point you in the right direction, or promt someone to present a better solution.
Cheers
Charles Kearny Kearny Technologies
|