Solr Score Explanation
In SAP Commerce backoffice, Solr only display final calculated score and most of the time business user needs to know why this score. Business manager want know more about impact of boosting in search results. Displaying solr debug or Solr result explanation to business user helps in tuning search results and this drive higher returns.
According to business, it would be most important to get an understanding of the below of Solr results.
-the baseline value of a product (in percent)
-the impact of boosting if applied (in percent)
Search settings can be fine-tuned from SAP commerce Backoffice.
Solr explains query results in as e.g.
Solr query explanation can be used to know about score calculations.
Common Query Parameters | Apache Solr Reference Guide 6.6
To address the business needs for understanding Solr search results in SAP Commerce backoffice, we can implement a solution that displays simplified Solr debug information to business users. This will help them understand the impact of boosting and fine-tune search results for higher returns. Here’s how we can approach this:
Displaying Simplified Solr Debug Information
- Enable debug mode: Add the
debugQuery=trueparameter to Solr queries in SAP Commerce. - Parse the debug information: Extract and simplify the relevant parts of the Solr explanation, focusing on:
- Baseline score
- Boosting impact
- Present in percentage format: Convert the scores to percentages for easier understanding by business users.
Key Components to Display
Baseline Value
- Calculate the baseline score without any boosting applied.
- Present this as a percentage of the maximum possible score.
Boosting Impact
- Identify the difference between the baseline score and the final score.
- Show this difference as a percentage increase or decrease.
Implementation Steps
- Modify Solr query handler:
SolrQuery query = new SolrQuery();
query.setQuery(userQuery);
query.set("debugQuery", "true");
- Parse Solr response:
QueryResponse response = solrServer.query(query);
Map<String, String> explainMap = response.getExplainMap();
- Extract and simplify scores:
for (String docId : explainMap.keySet()) {
String explain = explainMap.get(docId);
float baselineScore = extractBaselineScore(explain);
float finalScore = extractFinalScore(explain);
float boostImpact = finalScore - baselineScore;
// Convert to percentages
int baselinePercentage = (int) (baselineScore / maxPossibleScore * 100);
int boostPercentage = (int) (boostImpact / baselineScore * 100);
// Display to user
displayResults(docId, baselinePercentage, boostPercentage);
}
- Create a user-friendly interface in SAP Commerce backoffice to display these results.
Fine-tuning Search Settings
Provide options in the SAP Commerce backoffice for business users to adjust:
- Field weights
- Boost functions
- Query time boosting
For example:
q=cheese&bf=div(1,sum(1,price))^1.5
This query boosts documents based on price, with a boost factor of 1.5^10.
Benefits
- Transparency: Business users can understand why certain products rank higher.
- Iterative Improvement: Enables data-driven decisions for search optimization.
- Increased ROI: Better search results lead to improved user experience and potentially higher conversion rates.
By implementing this solution, SAP Commerce can provide business users with valuable insights into Solr’s scoring mechanism, allowing for more effective search result tuning and potentially driving higher returns.