4

After upgrading the project to Sitecore10.2 SOLR search result is different in order due to the query _val_:__boost function. I have investigated the issue and found out that in Sitecore 9.0.2 our SOLR search query was:

..........AND (-_template:("083a4d2a38694013a9e2d18c05da70ae") *:*))

and in Sitecore 10.2 SOLR search query is:

..........AND (-_template:("083a4d2a38694013a9e2d18c05da70ae") *:*)) AND _val_:__boost

There is one more extra condition at last in the query i.e. AND _val_:__boost. I have gone through the Sitecore documents on Search result boosting and found that In Sitecore XP 10.0.0 or later, item-level boosting relies on index-time scoring factors that are indexed in the __boost field and combined with the query score using the query _val_:__boost function.

I have also tried the below approach one by one but did not get any success:

  1. Disabled the boostingManager in Sitecore.ContentSearch.config file.
  2. Removed the StaticItemBoostResolver processor in Sitecore.ContentSearch.config file.
  3. Removed all the locations included in includedLocations in Sitecore.ContentSearch.config file.

_val_:__boost function is affecting our search result order and I want to remove the function from our search query.

2
  • 1
    Can you provide a sample of the c sharp code you're writing to query? Jun 8, 2022 at 13:48
  • You most likely have some boosting code that behaves differently than previous versions. Jun 8, 2022 at 15:23

2 Answers 2

2

I have raised a support ticket to the Sitecore for the above issue and they suggested me the two approaches:

Sitecore Response:

First of all, let me comment on the approaches you have already tried:

  1. Disabled the boostingManager in Sitecore.ContentSearch.config file.
    The disabled attribute is ignored and has no effect on the behavior.

  2. Removed the StaticItemBoostResolver processor in Sitecore.ContentSearch.config file.
    This was a step in the right direction. It means Sitecore will now ignore the value of the Boost field ('{93D1B217-B8F4-462E-BABF-68298C9CE667}') of the item.

  3. Removed all the location included in includedLocations in Sitecore.ContentSearch.config file.
    If no location is specified then all locations are scanned.

To achieve the desired behavior comment out all of the processors in the <indexing.resolveItemBoost> pipeline and rebuild the search indexes.

Alternatively, restore the original state of the pipeline. Clear the value of the Boost field ('{93D1B217-B8F4-462E-BABF-68298C9CE667}') for every item.
Remove any boosting rules under
/sitecore/system/Settings/Rules/Indexing and Search/Item Rules
/sitecore/system/Settings/Rules/Indexing and Search/Global Rules
Rebuild the search indexes.

The latter approach is recommended as it does not require changing the behavior of the product.

1

From what I can see it's a default now in Sitecore 10.X.

Looks like it's hardcoded in SolrQueryMapper and cannot be easily removed when you use Sitecore Content Search (see BoostQuery part):

public override SolrCompositeQuery MapQuery(IndexQuery query)
{
  SolrQueryMapper.SolrQueryMapperState state = new SolrQueryMapper.SolrQueryMapperState((IEnumerable<IExecutionContext>) this.Parameters.ExecutionContexts);
  return new SolrCompositeQuery(BoostQuery(Visit(query.RootNode, state)), state.FilterQuery, state.AdditionalQueryMethods, state.VirtualFieldProcessors, state.FacetQueries, state.ExecutionContexts);
}

and BoostQuery uses internally BoostByDocumentFieldSolrQuery which adds

string.Format("_val_:{0}", fieldName);
2
  • Thanks. I am trying to implement some suggestions provided by you and Michel West. I have also raised the support ticket to Sitecore for the same. Jun 9, 2022 at 4:08
  • 1
    Let us all know what they answer
    – Marek Musielak
    Jun 9, 2022 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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