1

I have this code:

  public class ResolveDemoBoostFactor : BaseResolveItemBoostPipelineProcessor
  {
    public override void Process(ResolveItemBoostArgs args)
    {
        Assert.ArgumentNotNull(args, nameof(args));
        Assert.ArgumentNotNull(args.Indexable, "indexable");
        if (!(args.Indexable is SitecoreIndexableItem indexable))
            return;
        args.ResolvedBoost += ResolveItemBoost(indexable);
    }
  }
  
  protected virtual float ResolveItemBoost(IIndexable indexable)
    {
        Assert.ArgumentNotNull(indexable, nameof(indexable));
        var item = (Item)(indexable as SitecoreIndexableItem);
        if (item != null)
        {
            //add your logic to determine whether or not the item should be boosted.
            var boostValue = item.Fields["__boost"].HasValue ? item.Fields["__boost"].Value : null;
            //if (!string.IsNullOrEmpty(boostValue))
            if (item.Fields["pagetitle"] != null && 
            item.Fields["pagetitle"].Value.Contains("More"))
            {
                var @float = Convert.ToSingle(boostValue);

                return @float;
            }
        }

        return 0.0f;
  }

These are the config changes:

<indexing.resolveItemBoost help="Processors should derive from Sitecore.ContentSearch.Pipelines.ResolveBoost.ResolveItemBoost.BaseResolveItemBoostPipelineProcessor">
  <processor type="AvistaSearchWeb.Item_Booster.ResolveDemoBoostFactor, AvistaSearchWeb"/>
</indexing.resolveItemBoost>

The code executes successfully when I index, but the items are never boosted. Does anyone know what the issue might be?

1
  • As per the official Sitecore statement, Search result boosting works in Solr version 6.6 or earlier, but Solr changed the implementation in Solr 7, and later versions. Therefore, search result boosting is broken in Sitecore 9.1, 9.2, and 9.3. doc.sitecore.com/developers/90/… Jun 11 at 4:50
3

Some clarification of the comment here:

Search result boosting works in Solr version 6.6 or earlier, but Solr changed the implementation in Solr 7, and later versions. Therefore, search result boosting is broken in Sitecore 9.1, 9.2, and 9.3.

In SItecore 10, and later, item-level boosting works again, but field-level boosting does not. Sitecore stores the item boosting factor in a separate field in the Solr index ((__boost : pfloat). Sitecore uses the value in this field for boosting.

This is talking only about index time boosting. Boosting on when performing search works without any issues.

Why? It was due to a change in Solr (from 6.5) and how the index time boost fields were used in the dismax parser. Deprecate index-time boots

LUCENE-6819: Index-time boosts are not supported anymore. As a replacement, index-time scoring factors should be indexed into a doc value field and combined at query time using eg. FunctionScoreQuery.

The E(extended)dismax (edismax) parser does provide support for index time boosting, but in Sitecore 9 you have to change how you query to use that: See this post for detail: https://stevenstriga.com/2019/03/28/edismax-series-post-1-introduction-to-sitecore-solr-edismax/

ref: https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/search-result-boosting.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.