ASPX templates
Version 3.x > ASPX templates > CMSSearchResults and multi-field document type search View modes: 
User avatar
Member
Member
Erik - 2/19/2009 9:47:12 AM
   
CMSSearchResults and multi-field document type search
We're working on a site that requires a few document types, one of which I need to set up a search for. They would like to search by as many as four criteria fields (first name, last name, town, and specialty -- this is a doctor search). The name and town fields are simple text fields, but the specialty field is a CheckBoxList that is filled by another custom document type in the database.

I was hoping to use the out-of-the-box CMSSearchResults control to feed the search criteria, but I am not getting back any results, and no errors either. Here's my markup for the control:

<cms:CMSSearchResults ID="results" runat="server" SearchMode="AnyWord"
FilterOutDuplicates="true" ClassNames="medical.physician"
TransformationName="medical.physician.SearchResults"
SearchScope="SearchAllContent" CMSSearchDialogID="cmsSearch"
PagerControl-PageSize="20" PagerControl-PagerPosition="TopAndBottom"
PagerControl-PagerHTMLAfter="<br /><br />" />

The code-behind that does the search:

results.SearchExpression = (txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim() + " " + txtTown.Text.Trim()).Trim();
if (results.SearchExpression.Trim() != "")
{
results.DataBind();
}

Anyone with experience doing document type searching via multiple criteria fields? I am aware of the custom search provider possibility, but would like to avoid that (trying to go out-of-box as much as possible). The more I think about it, though, I think this might be required in order to support the CheckBoxList field described above.

Erik Bertrand
Amplify Studios
Manchester, NH USA

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/25/2009 6:10:29 AM
   
RE:CMSSearchResults and multi-field document type search
Hi,

In your case it would be easier to implement it using repeater web part - you will have some fields on the page and then you will set the WHERE condition of the repeater according to the values in those fields. So, the repeater will display appropriate records.

Achieving this using search will require more and complicated customization of the search engine.

Best Regards,
Juraj Ondrus