Follow up on implementing freshness boosting when using the default processor.

CommentFileSizeAuthor
#6 3086300.patch15.01 KBmkalkbrenner

Comments

dksdev01 created an issue. See original summary.

dksdev01’s picture

Temporary fix --
using hook_search_api_solr_converted_query_alter

  $index = $query->getIndex();
  $fields = $index->getServerInstance()
    ->getBackend()
    ->getSolrFieldNames($index);
  $boost_functions = '';

  if (strstr($query_parameters, 'date') === FALSE) {
    $date_field = 'created';
    $solr_field = !empty($fields[$date_field]) ? $fields[$date_field] : '';
    if ($solr_field) {
      $boost_functions = 'sum(boost_document,recip(abs(ms(NOW/HOUR,' . $solr_field . ')),3.16e-11,2.0,0.08))';
      $query_str = str_replace("boost_document", $boost_functions, $query_str);
      $solarium_query->setQuery($query_str);
    }
  }

Not sure if it helps.

mkalkbrenner’s picture

Version: 8.x-3.x-dev » 4.x-dev
mkalkbrenner’s picture

Issue tags: +sponsorships

Ideally we create a Search API Processor where you can enter the numbers for the date calculation.
And instead of manipulating the query we will nativly support this feature regardless of the chosen query parser.

(We're still looking for a sponsor or a contribution here.)

mkalkbrenner’s picture

My suggestion is that we provide a sophisticated config form that allows a setting for every date field in the index:

  • boost / no boost
  • resolution: ms, s, h, day, week, month, year
  • constant m: text, default is 3.16e-11
  • constant a: float, default is 0.1
  • constant b: float, default is 0.05

A more convenient settings form that provides preselected combinations could be added later in a second step.

The settings are required to adjust the scoring across a configurable period of time. Otherwise you end up in one hardcoded algorithm that for example boosts the last 4 days very high, the last week a bit and eveything els is not effected while others need to rank documents from the least year higher compared to two years ago.

mkalkbrenner’s picture

Status: Active » Needs review
StatusFileSize
new15.01 KB

  • mkalkbrenner committed 6ef2ea0 on 4.x
    Issue #3086300 by mkalkbrenner: boost by date processor
    

  • mkalkbrenner committed e029877 on 4.x
    Issue #3086300 by mkalkbrenner: boost by date processor
    

  • mkalkbrenner committed 67e38fb on 4.x
    Issue #3086300 by mkalkbrenner: boost by date processor
    

  • mkalkbrenner committed 88c863e on 4.x
    Issue #3086300 by mkalkbrenner: boost by date processor
    

mkalkbrenner’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.