Portal Engine
Version 2.x > Portal Engine > Customizing search inputs View modes: 
User avatar
jgloege@matrixgroup.net - 10/8/2007 4:59:08 PM
Customizing search inputs
I've found a way to make the search functionality work around a corner I'd come up against, but I'm trying to see if I can make the input for the search a little more full-featured. I've managed to limit my searching to a directory where all that's present is the "office" pages that I need to search, but I want to see if I can add some options for users to drill in a little more. Example:

Office Name:
State/Province: (pull-down menu)
Postal Code:
Office Type:

I know how I can tweak the results page to show me what I need to see when results are returned, but I can't find any documentation on how to tweak the input, so that I can make it do what I need it to.

Can anyone help? Any assistance is greatly appreciated.

User avatar
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.


Charles Kearny
Kearny Technologies