Explain rank in Sharepoint 2013 Search

Default ranking model in Sharepoint 2013 is completely different from what we’ve seen in FS4SP and is definitely a step forward comparing to SP2010. In a nutshell it uses multiple features (to take into account query terms, it’s proximity; document click-through, authority, anchor text, url depth etc ) which are mixed with help of neural network as a final step. Details can be found in patent claim http://www.google.com/patents/US8296292.

Hopefully there’s a way to bring more light into this black magic. I’ve modified default Display Template and added “Explain Rank” link to each item. This link redirects user to ExplainRank page which hosted under {search_center_url}/_layouts/15/ folder.

1 - starwars

I used

  • d=ctx.CurrentItem.Path
  • q=ctx.DataProvider.$2_3.k  (have found this hidden property using trial & error method)
  • another option is to extract value for q= from QueryText from ctx.ListData.Properties.SerializedQuery which value was<Query Culture=”en-US” EnableStemming=”True” EnablePhonetic=”False” EnableNicknames=”False” IgnoreAllNoiseQuery=”True” SummaryLength=”180″ MaxSnippetLength=”180″ DesiredSnippetLength=”90″ KeywordInclusion=”0″ QueryText=”star wars” QueryTemplate=”{searchboxquery}” TrimDuplicates=”True” Site=”1436c4c3-34b4-4e32-bd41-4d28fc0f1435″ Web=”5291616c-f750-45db-9e3b-68c7c2e82b9f” KeywordType=”True” HiddenConstraints=”” />”)
var explainHtml = String.format('<a href="/_layouts/15/ExplainRank.aspx?q={0}&d={1}" title="Explain">Explain Rank</a>',

(upd: here’s a link to complete display template http://pastebin.com/SfbFj9yG)
ExplainRank.aspx page essentially performs following actions:

  • Prepares KeywordQuery with values specified in URL (query, item url, + a number of configuration parameters that exist in SerializedQuery but were omitted in this demo for the sake of simplicity)
  • Specifies to retrieve ranklog property.
  • Executes query
  • Parsers ranklog with help of RankLogParser (Microsoft.Office.Server.Search.Administration)
  • Renders features/scores using controls derived from RenderableRankingFeature (Microsoft.Office.Server.Search.WebControls)

As a results you are able to review detailed explanation on rank log calculation and have a better understanding why a given document scored with specific rank.

Even if you’re not familiar with advanced information retrieval ranking models, you will easily locate in which properties there were hits, which features contributed to final score.

3 - explainrank

This is only the beginning of our journey into ranking and relevancy tuning of SharePoint 2013 Search. Stay tuned, in next chapters we will dive more deep.

%d bloggers like this: