Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Filtering Smart Search results by category using web part search condition field. View modes: 
User avatar
Member
Member
ryan-norex - 9/10/2012 1:48:53 PM
   
Filtering Smart Search results by category using web part search condition field.
I'm using the smart search module, and it worked great up until now. I have some filters I'm using, not using the Smart Search Filter web part. I use querystrings and fill the search condition area in the Smart Search web part using those.

My issue is occuring when I try to filter by category. I have the selected category ID, and I only want to display documents with that category. My category field is called ArticleCategory.

I was trying to do something like +ArticleCategory:15 , but it looks as though category ids are stored as a common separated string field, so that wouldn't work. And it appears you can only do exact matches, or ranges with that syntax. I then tried to write a custom macro function, that gets all the documents given the category id, and prints out conditions for
each like:


+DocumentID:100
+DocumentID:150


etc.

Although, putting this in the condition area doesn't seem to work. I'm doing it programmatically in a macro function like:


string result = "";
foreach (DataRow dr in ds.Tables[0].Rows) {
result += "+DocumentID:" + dr["DocumentID"].ToString() + Environment.NewLine;
}
return result;


and result should be placed in the search condition area. This is not working either, I'm assuming you can only match against a field once.

Are there any other solutions I could use to filter the search results by category, I'm completely out of ideas.

If you have any other questions feel free to respond and I'll get back to them ASAP.

Thanks.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 9/11/2012 5:10:30 AM
   
RE:Filtering Smart Search results by category using web part search condition field.
Hello,


Can you see this knowledge base article? How to search for documents using assigned categories Does it help?


Best regards,
Helena Grulichova

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 9/11/2012 4:45:16 PM
   
RE:Filtering Smart Search results by category using web part search condition field.
Here is another thread where I answered this question and got it working.
http://devnet.kentico.com/Forums.aspx?forumid=55&threadid=29047

User avatar
Member
Member
ryan-norex - 9/12/2012 7:05:36 AM
   
RE:Filtering Smart Search results by category using web part search condition field.
Thanks for the reply!

I got it working using something similar to your suggestion in that thread. I emailed support and they provided me with a similar suggestion.