volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Offsmart_toy

How to include SortOrder in ProductContent search?

The case is:

Search for products and order by its SortOrder property (from NodeEntryRelation).

How to index SortOrder property along with CatalogId, CatalogNodeId and include it in search results?

#285295
Edited, Aug 10, 2022 8:49
Vote:

You can include almost anything with your index using extension method, something like this (pseudo code)

public static in SortOrder (this EntryContentBase entry)

{

var nodeEntryRelations = _relationRepository.GetParents<NodeEntryRelation>(entry.ContentLink);

var primaryParent = nodeEntryRelations.FirstOrDefault(x=>x.IsPrimary);

return primaryParent.SortOrder;  

}

Then you can include that in your conventions

#285298
Aug 10, 2022 10:05

Fantastic, Quan Mai, thank you very much!

#285299
Aug 10, 2022 10:52
error 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.