New answers tagged

0

I ended up created the extension method. public static IEnumerable<Item> GetDescendantsByTemplateWithFallback(Item rootItem, string templateId) { return from i in rootItem.EnsureFallbackVersionIfExist().Axes.GetDescendants() where i.TemplateID == new TemplateID(ID.Parse(templateId)) select i; }


2

LanguageFallbackDataService was marked as obsolete in 9.3. No replacement was provided in obsolete info. This kb article describes a bug which is strictly related to GetDescendantsByTemplateWithFallback extension method Replacement I tracked how previous usages in Sitecore were updated and I found one. Here is a code example: before result = property....


0

I'm not sure when it changed but in Sitecore 10.x you now need to change the returnType parameter which is used for whether the field gets tokenized or not. For example string does not get tokenized but text does. <field fieldName="firstlastname" returnType="string"> Sitecore.Fields.FirstLastNameComputedField, Circle.Fields</...


3

This is a long known issue with Solr, where if a field is stored / has analyzers / is tokenized, it returns incorrect results. This is vaguely mentioned on the documentation here. It was blogged about years ago by Rich Seal here who said that you can add a copyField with parameters indexed="true" stored="false" and then sort by that field....


0

Building on the answer about solr.RandomSortField, Sitecore now provides the random dynamic field automatically, it's ready to use. Here is a blog post on the topic for details, but essentially you can just use it like: var random = $"{new Random().Next()}_random"; queryable.OrderBy(result => result[random]);


1

I wound up using the approach recommended by @AnnaGevel and added a boosted keywords field. While I don't think this is quite as precise as the Query Elevation Component would be, it's maintainable by content editors without needing to write a custom add-on.


Top 50 recent answers are included