Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Smart Search and Categories View modes: 
User avatar
Certified Developer 9
Certified Developer 9
robert.redhead-t4g - 12/31/2010 12:43:06 PM
   
Smart Search and Categories
Hello, I have a Smart Search Index set up on my dev site. The design calls for the ability to filter the results by selected Categories (from the Categories module) but I can't get it to work. this is what I tried:
-added a column to cms.Document called DocumentCategories (similar to DocumentTags)
-created a event hanlder to collate the categories and save them in the new field (again like tags)
-added a system field to Page Menu Item, set it to DocuemntCategories, and set the search options. (similar to the BlogPost document type, which has documenttags)

The custom event updates the field ok, I can see the list of categories per document in the CMS_Document table. However when I try filitering on DocumentCategories using the smart search filiter (+documentcategories;categoryA;Category A) nothing is returned. When I view the form of the page that has this category, the field DocumentCategories is blank. Indicating to me that the field is not automatically read, and smart search will see it as blank.
I've tried to mimic Tags, but there seems to be more involved. Did I miss anything to make this approach work? Or is there a better approach?

Any help appreciated

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/3/2011 8:52:21 AM
   
RE:Smart Search and Categories
Hi,

If I got it the right way, you have:

1. a custom form control called DocumentCategories that stores appropriate categories in format CategoryA, CategoryB, GPRS, Whatever.
2. you are using this form control in Page (menu item) = CMS.MenuItem document type.
3. In definition of your page (menu item) document type - Search fields tab you checked boxes
Content and Tokenized for your custom form control with code name DocumentCategories.
4. You have created some page menu item documents and filled documentCategories field in format described in point 1.
5. You have rebuilt the index in Site Manager - Administration - Smart search
6. You used Smart search dialog webpart in combination with smart search filter and smart search result.
7. In smart search webpart you have set option:
+documentcategories;categoryA;Category A
8. In smart search result you have set Search options*: full
9. If you created page menu item document type with name Example and its DocumentCategories field contents CategoryA, CategoryB, GPRS, you should see this result when you type Example into search box and select Category A in filter options.

If you followed all above steps and searching is not working, could you please grant me with an access (you could send it support@kentico.com with reference to this thread)?.

Best regards,
Ivana Tomanickova

User avatar
Certified Developer 9
Certified Developer 9
Rob R - 1/3/2011 5:15:49 PM
   
RE:Smart Search and Categories
Thats nearly it. From 3. on sounds about right. But:
In 1. I didn't create a custom form, I created a custom event handler for the OnBeforeUpdate event that saves the categories into a single field.
For 2. I wanted this field to be available to all document types, so in the database I added it to the CMS.Document table. What I wanted to avoid was adding a field to each document type that requires categorization (which would be quite a few).
What you describe sound like the later, I'll give that a try on a few doc types, but is there a way to add a field that can be inherited by all document types? I can see this coming up again at some point.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 1/4/2011 7:51:00 AM
   
RE:Smart Search and Categories
Hi,

the search option Searchable should be checked as well while you are using field as a condition in your smart search filter webpart. I am sorry for confusion. For more info please take a look here.

You could use default DocumentCustomData column in CMS.Document table. If you go to Site Manager - Development - System table - Ecommerce SKU you could check all 3 options in Search fields tab for this field. Then you could fill this column with your category data and rebuild index. Filter condition should look like:
+documentcustomdata;categorya;Category A

This way DocumentCustomData field will be inherited by all document types and will be searchable.

Best regards,
Ivana Tomanickova

User avatar
Certified Developer 9
Certified Developer 9
Rob R - 1/4/2011 9:36:38 AM
   
RE:Smart Search and Categories
Perfect! I got it working the way it's intended now using the DocumentCustomData. Thanks!