Try our conversational search powered by Generative AI!

Specify a catalogue node as start for indexing


I would like to create an index that excludes one particular catalogue node. Is this feasible? Are there work arounds?

May 29, 2018 11:38

If you are using Find.Commerce, it's fairly easy to do. But you are using the "old" search provider then no, there is no way I know of. 

May 29, 2018 12:20

Thanks for your reply Quan. I'm using Episerver old school, so that is unfortunate.

May 29, 2018 12:49

Oh perhaps you can, just not simple.

If you create an indexbuilder yourself (inherit from CatalogIndexBuilder), you can override IndexCatalogEntryDto(IndexBuilder indexer, CatalogEntryDto.CatalogEntryRow entryRow, string defaultCurrency, string[] languages). Based on the entry, you can check if it belong to a specific category or not, and skip indexing if it is.

Things will get trickier if you have multiple level of inheritance, but that's when IRelationRepository comes to rescue.

May 29, 2018 13:00

Thank you Quan, I will definitely try that out!

May 29, 2018 13:05

How do I check if the entry belongs to a specific category?

May 29, 2018 13:23

var parentNodeRelations = _relationRepository.GetParents<NodeRelation>(entryLink);

You would need to use ReferenceConverter to get the entryLink from either entry code or Id. Then you make sure parentNodeRelations  contains a specific node contentLink.

As I said if you have multiple levels of category then it's much trickier, but basically use _relationRepository.GetParents<NodeRelation> until you get there 

May 29, 2018 13:27

I do not think GetParents is a method on RelationRepository, are you sure it exist?

May 29, 2018 13:33

Yes I am 

However it's new in Commerce 11. If you are using something older, you would have to stick with GetRelationsBySource/Target 

May 29, 2018 13:35

Oh, I see. I will try the GetRelationsBySource/Target.

May 29, 2018 13:37
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.