Search Boost changes in 11

I'm trying to override the boost function using the example in https://community.telligent.com/community/8/f/ask-the-community/1145622/posted-date-influence-in-solr-search

However, it is not working.  In version 11, sum(contentscore,+1) is passed to the query rather than the {!boost+b%3Dsum(contentscore,1)+defType%3Dedismax} that was in place in the previous version.

private void SolrEvents_BeforeSearch(BeforeSolrSearchEventArgs e)
{
if (e.SolrOptions.Url.Contains("boost"))
{
e.SolrOptions.Url = e.SolrOptions.Url.Replace("boost=sum(contentscore,+1)", "boost=recip(ms(NOW,date),3.16e-11,20,1)");//replace boost here; 
}

}

Parents
  • As you have probably discovered, its a querystring parameter value in version 11. Even though the string looks right, instead of doing string matching you probably want to parse the url into key value pairs and get the "boost" parameter.

    As for not working, do you mean that its does not appear to apply the boost? Have you adjusted values drastically to confirm (ex. 1,1)? Do you have access to the admin Solr panel to run the query and look at the debug results. The solr logs will have a copy of the raw queries. To view debug results append '&debug=true' to the query when executing directly against Solr.

  • boost=sum(contentscore,+1) is actually boost=sum(contentscore, 1)  in the query string (the + is actually an empty string).  Added the string to event log and figured it out.  

Reply Children
No Data