Try our conversational search powered by Generative AI!

How to disable Find indexing on specific products


Hi guys, 

I would like to find a way to exclude some products(VariationContent) in the Find search result, the products which are located in a not active category (set as NOT available in commerce)

In CMS I can add a bool DisableIndexing in a page type, do I need to do silmiar thing and build a job to set disableIndexing = true to the products?

Please provide me some suggestions.


Sep 21, 2018 10:15

You can do like this - just change the code inside ShouldIndex to what you would like 

     .ShouldIndex(x => ShouldIndex(x));
bool ShouldIndex(IContent content)
     var ancestors = _contentLoader.GetAncestors(contentLink).OfType<FashionNode>();
     if (ancestors.Any(c => c.Name == "Mens"))
         return false;
     return true;
Sep 21, 2018 11:28

Thank you Quan! 

I will try this solution. :) 

I have other scenario, how shall I do to hide the customer specificed products in search result?

When a customer login, he has customer specified products and he should be able to search it but not anonymous user.

Sep 21, 2018 11:47

The new question should be in a separate thread. To you can always filter the search result by adding a property - for example ForRegisteredUserOnly, and use that to filter with Find 

Sep 21, 2018 11:48

Sorry, I will open a new thread next time. 

Thanks for the tips!  

Sep 21, 2018 12:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.