Hello,
I would like to show an implementation of a custom crawler which prevents indexing items under specific paths. This is useful when you want to exclude a whole subtree from your index configurations. e.g: You have a multi-site structure which contains 3 sites. You want to implement search funcationlity on one of the sites (call site A) and visitors should be able to search in site B content, but content from site C should not be visible, and you dont want to break relevancy of the search result.
The first step is create a class, call CustomCrawler.cs. This class should be derived from SitecoreItemCrawler class. Now, you can overwrite IsExcludedFromIndex method.
If you are ready, you should change crawler in the search config. Add paths to ExcludeRoot node and seperate them by pipes.
That's all. Now items are not indexed from the excluded paths, and you don't break the relevancy.
I would like to show an implementation of a custom crawler which prevents indexing items under specific paths. This is useful when you want to exclude a whole subtree from your index configurations. e.g: You have a multi-site structure which contains 3 sites. You want to implement search funcationlity on one of the sites (call site A) and visitors should be able to search in site B content, but content from site C should not be visible, and you dont want to break relevancy of the search result.
The first step is create a class, call CustomCrawler.cs. This class should be derived from SitecoreItemCrawler class. Now, you can overwrite IsExcludedFromIndex method.
If you are ready, you should change crawler in the search config. Add paths to ExcludeRoot node and seperate them by pipes.
That's all. Now items are not indexed from the excluded paths, and you don't break the relevancy.
Hello I am trying to run this with the Publishing Module to exclude items from the index. When it runs the item is named Messages and shows Core database not the expected item I was publishing in Master. Do you know if it is because how Publishing Module is run and if there is a workaround? Thanks.
ReplyDeleteHello,
ReplyDeleteYour blog has a lot of valuable information . Thanks for your time on putting these all together.. Really helpful blog..I just wanted to share information about
devops online training