For the second part of the Filtered Search Sample we are going to look at the data layer to support our Filtered Search presentation. The implementation here is being implemented with Sitecore as the data store but the pattern could easily be some other CMS or just a database.
Our filtering is based on searching across the repository for items that have the criteria we are looking for. This requires two basic things. The first being our items need to be tagged in some fashion and the second is that those tags are made available to the user to include or exclude from the results. Above you can see that we have a hierarchical tagging structure. This allows nested tags such as an Article and a White Paper can have the same parent and then we can allow the parent of "Article / White Paper" be used in the Filtered Search.
You can also see that a Tag is more than just a string field. This allows us to associate a Tag with an icon and a description if we want. The PowerFilter property of the Tag is what we are using to tell the system if we want the Tag to be listed in the Filtered Search module. We are using Tags for a lot more than just the FilteredSearch so this field allows us to flag the Tag as an item we want the user to be able to filter on.
Here you see we have a configuration element in Sitecore that allows a content manager to specify the title, the instructions, how many results should be displayed per page and which Tag Categories should be used.
The PowerFilter Sublayout is just an .ascx User Control that inherits from the SublayoutBase - if you are not familiar with Sitecore it is merely a base class that makes it easier to get access to the context in which the control is being used. Here we are setting the context of control to the PowerFilter item we just discussed. We are binding an ASP.NET Repeater to the Tag Categories chosen and we actually have a repeater within a repeater that will list out each Tag within the Tag Categories if it's PowerFilter property is set to true.
We have covered the presentation and now the tagging structure we setup using Sitecore; next we will go into implementing the service layer that will respond to the Ajax calls that actually get the results to be displayed.
| Leave a comment »