Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Smart Search filters by object type View modes: 
User avatar
Member
Member
efusien - 11/2/2010 2:28:40 PM
   
Smart Search filters by object type
Hello,

I have a Smart search using indexes on my website.
The search returns results, but I would like to filter these results for some of document types.

In exemple, I don't want to index "News" document types if the field "Link" is filled.
So it means I don't want to see News with a link property filled in any search result.

Is there a way to do such a filter ?

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 11/3/2010 11:34:27 AM
   
RE:Smart Search filters by object type
Hi,

Documents are indexed in your smart search index according to specified content tree path, document types, culture and site. There is no other way to simply not index documents according to some special condition – the only way here would be not to display them in smart search result.

It is sort of problem in LUCENE search engine (used in Kentico CMS smart search module) to compare string fields for emptiness. In other words, as far as I know, you cannot achieve this with simple condition in Search condition property of smart search result web part.

However, following workaround could help you. You can add field of type Boolean (let’s say with name IsLinkChecked) to your document type fields. Then if the Link document field is filled, you would need to set IsLinkChecked field to true (checked). You can automate this process with custom code in custom tree node handler (http://devnet.kentico.com/docs/devguide/treenode_handler.htm) where you will set programmatically IsLinkChecked field to true if Link field is not empty.

Then you can use following condition in your Search condition property of your smart search result web part to filter our documents with IsLinkChecked field set to true:

Search condition: -IsLinkChecked:True

Please make search that the field is searchable.

I hope this will help you. For more information about smart search module, please refer to following documentation:

http://devnet.kentico.com/docs/devguide/smart_search_overview.htm

Best regards,
Miroslav Remias.