API
Version 7.x > API > Smart Search Filter by Category View modes: 
User avatar
Member
Member
christine - 8/8/2013 8:24:45 AM
   
Smart Search Filter by Category
I am having some trouble implementing a smart search filter that is based on Document Categories.

The categories have been set up at the site level, assigned to the documents, and I have included categories in the search index along with rebuilding the search index several times.

I have followed steps from this forum post and this Knowledge Base article

The filter is set up to show as check boxes and they are displaying the category names correctly, however, when checked they are not filtering the results. I have tried changing the Filter Mode to drop downlist and radio button and the filter still did not work.

Kentico site version numbers are 7.0.13 and 7.0.4738

Any help at all would be greatly appreciated.

- Christine

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/8/2013 4:53:51 PM
   
RE:Smart Search Filter by Category
Have you seen this post on Faceted Search?

http://devnet.kentico.com/Blogs/Jakub-Oczko/August-2012/Kentico-CMS-7-Smart-Search.aspx

User avatar
Member
Member
christine - 8/9/2013 7:21:02 AM
   
RE:Smart Search Filter by Category
Yes, I have, that is where I got the idea to try and filter by category. That post does not give much information on how to actually get that working though, unless I am missing something.

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/9/2013 12:54:03 PM
   
RE:Smart Search Filter by Category
Do you have a corporate template example site that you can reference? That's what I used to see an example of the faceted search in action or any other web part.

User avatar
Member
Member
christine - 8/9/2013 12:58:17 PM
   
RE:Smart Search Filter by Category
No, I don't unfortunately. I inherited this site from a former colleague so it has been a lot of trial and error for projects like this search

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/9/2013 1:37:47 PM
   
RE:Smart Search Filter by Category
You can install one pretty easily. Go to the Site Manager > Sites > + New site wizard. Then select "Use website template" > "Corporate Site" for an existing instance or use the Kentico Installation Manager for a new instance . It would be worth it in the long run. Having working examples of all the web parts has saved me a ton of time.

It looks like to me, that it requires a Smart search filter web part linked to a Smart search dialog web part. The smart search filter has this a query: cms.root.smartsearchcategories: SELECT 'DocumentCategoryIDs', CategoryID, CategoryDisplayName FROM CMS_Category WHERE ##WHERE## ORDER BY ##ORDERBY##. This a the where clause: ((CategorySiteID IS NULL) OR (CategorySiteID = {% CurrentSite.SiteID %})).

User avatar
Member
Member
christine - 8/9/2013 2:22:42 PM
   
RE:Smart Search Filter by Category
Thank you so much jellison!

I will be using the Corporate site example in the future a lot to help figure out some of the webparts.

I now have my category filter working wonderfully!

Thank you again for all your help!

User avatar
Member
Member
christine - 8/9/2013 2:34:06 PM
   
RE:Smart Search Filter by Category
Actually, do you have a problem where the categories checked become unchecked when you move to the next result page?

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/9/2013 2:36:55 PM
   
RE:Smart Search Filter by Category
I had to do something a little more custom, so I couldn't utilize that web part. Is Viewstate disabled for that web part?

User avatar
Member
Member
christine - 8/9/2013 2:40:25 PM
   
RE:Smart Search Filter by Category
No, its not. The same thing happens on the corporate site example, so I will probably end up having to do some custom work to get it working how I need it to.

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/9/2013 2:46:47 PM
   
RE:Smart Search Filter by Category
Ah. Let me know if you figure it out. Would be good to know for future reference.

User avatar
Member
Member
christine - 8/9/2013 2:48:35 PM
   
RE:Smart Search Filter by Category
I will post any changes I have to make on here

User avatar
Member
Member
rlull - 9/12/2013 2:00:16 PM
   
RE:Smart Search Filter by Category
Did you ever figure out how to maintain the checkbox selection between postbacks when paging through the results?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/13/2013 2:35:19 AM
   
RE:Smart Search Filter by Category
Hi,

Regrettably, this seems to be a bug in the current version. I'm very sorry for this inconvenience. We will try fix it in the next version or in the next hotfix package for this particular Kentico CMS version.

Best regards,
Juraj Ondrus

User avatar
Member
Member
christine - 9/13/2013 7:20:15 AM
   
RE:Smart Search Filter by Category
I know what the problem is, I haven't fixed it yet though since I've been working on getting it to filter document attachments by category as well.

The issue is caused by the "FilterAutoPostback= true" setting on the search filter. For some reason with auto postback turned on, the category values are not added to the query string on the url. If you click the 'Search' button again though, the values are added to the url, which kind of defeats the purpose of auto postback...

I will be posting some custom code later today that allows you to filter the document attachments by category as well.