Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Auto boosting

Describes the Optimizely Search & Navigation concept of automatic boosting of search scores results based on document age or popularity.

By default, Optimizely Search & Navigation sorts search results according to score (relevance). In some applications, boosting the score using document age or popularity (tracked hit count) enhances the relevance of the results. You can use auto boosting to achieve this. It uses document hit count (hit boost) and age (decay) to determine boost.

Search using auto boosting

The following code sample increases the probability that new and popular blog posts about banana are sorted first in search results.

searchResult = client.Search<BlogPost>()
  .For("Banana")
  .UsingAutoBoost(TimeSpan.FromDays(14))
  .GetResult();

Parameters

  • decayScale – TimeSpan (required)
  • decayOffset – TimeSpan (optional)
  • decayShape – double (optional)
  • decayMinimum – double (optional)
  • decayOrigin – DateTime (optional)
  • hitBoostScale – double (optional)
  • hitBoostOffset – double (optional)

Hit boost

Use hit boost to increase the score of frequently used hits. For a document, Optimizely Search & Navigation calculates hit boost as the inverted exponential decay based on the ratio between the tracked hit count and the total tracked hit count for the entire index, where the hit boost ranges between 1.0 and 2.0.

📘

Note

Tracking is required to utilize the hit boost aspect of UsingAutoBoost().

To control the rapidity of the decay, set the half-life with the hitBoostScale parameter, where the boost is at 50%. By default, hitBoostScale is set to 0.1 (10%). Lowering the scale makes the inverted decay more rapid. Setting a value higher than 0.1 leads to a cut-off where the hit boost cannot reach the upper range limit.

You can set the hitBoostOffset parameter (0.0 by default; ignore no documents) to ignore documents with few hits. Because the influence of hit counts is slight in most indexes, the offset should normally stay at 0 or a very small number. Setting the offset to 1.0 effectively turns off the hit boost.

Image: hitBoostOffset parameter

Decay

Use Decay to boost the score for recent documents. For a document, Optimizely Search & Navigation calculates this as the exponential (Weibull) decay based on the distance between a date value associated with a document and a fixed point in time. Normally, the date value is the document age or updated date value, and the fixed point in time is the search time. A date value at, or after, the fixed point in time gets a boost of 1.0, while a date value before the fixed point in time nears a minimum value (by default, 0.2).

  • decayScale – Like hit boost, you control the decay half-life by setting the decayScale parameter. This parameter is required because the scale is highly application-dependent and has no sensible default value. The scale is a timespan value.
  • decayShape – You can also affect decay by setting the decayShape parameter (default is 1.0, equal to exponential decay), equivalent to setting the k-value in the Weibull cumulative distribution used to calculate decay in auto boosting. The shape can range from a more rapid decay (k < 1.0) to a more sigmoidal one (k > 1.0).
  • decayOrigin – Decay is measured from the time of the request. You can set another time using the decayOrigin parameter. Dates after the origin are limited.
  • decayOffset – You can set a grace period for documents near the origin using the decayOffset parameter, which does not apply decay within the grace period, and the decay starts immediately after. The offset sets a timespan value.
  • decayMinimum – You can use the minimum value to modify the dynamic range of the decay by setting the decayMinimum parameter from 0.0 (full range) to 1.0 (no range). Setting the minimum to 1.0 essentially turns off the decay. If you cannot determine a date value, the decay defaults to the middle of the range, by default 0.6.

Image: decayShape parameter

Per document type 

You can set decay parameters per document type using client.conventions.

client.Conventions
  .ForInstancesOf<BlogPost>()
  .SetDecayParameters(new DateDecayParameters(TimeSpan.FromDays(60)));

The code applies the decay parameter for specified types and sub-types documents. When you use per-type decay parameters, the default scale parameter (UsingAutoBoost()) is optional.