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>',
ctx.DataProvider.$2_3.k,
ctx.CurrentItem.Path);

(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.

Advertisements

20 Responses to Explain rank in Sharepoint 2013 Search

  1. Sergey Tihon says:

    Reblogged this on Sergey Tihon's Blog and commented:
    Add your thoughts here… (optional)

  2. Chris Chance says:

    Can you post the entire value of the explainHtml variable ? I am having difficulty getting the value of QueryText.

    Thank you,

  3. Steve Curran says:

    Very nice find and very useful.

  4. Pingback: How SharePoint 2013 Ranking models work | Insights into search black magic

  5. Darrin Allred says:

    I’m getting a 403 forbidden trying to display the explainrank.aspx page. I’m accessing the page as a site collection owner and farm administrator. Any ideas?

  6. dadunar says:

    The ExplainRank.aspx page doesn’t work for BDC search results.
    Complete URL:
    http://spv15-dev-web01/_layouts/15/ExplainRank.aspx?q=tool&d=bdc3://fastenal_vendors_fastenal_vendors/Default/00000000%252D0000%252D0000%252D0000%252D000000000000/4495/Fastenal%2520Vendors/5089?s_id=injUAAA==&s_ce=04081020800080g102000400g000f7

    It says: “Error parsing ranklog XML: Requested document not returned in the query.”

    I guess is because of the URL of this bdc3://xxxxx

    Then, how to get it work for BDC search results?

  7. Pingback: Neural networks in Visual Studio and SharePoint Search | Insights into search black magic

  8. jo-an says:

    aside from ‘d’ and ‘q’, are there other parameters that we can use for the explainrank.aspx page? for example, i want to use other rankingmodelid, is it possible to pass the guid to this page?

  9. Pingback: Sharepoint 2013 Search Ranking and Relevancy Part 1: Let’s compare to FS14 | Search Unleashed

  10. Elio Struyf says:

    Alexey,

    Great post, just discovered it yesterday during a search session given by Joris Poelmans. The only thing that my eye fell on was that you use a hidden property $2_3. You could also retrieve the query text with methods like this:

    ctx.DataProvider.get_currentQueryState().k

    Thanks for the share.

    Regards,
    Elio

  11. Pingback: Search Query Tool v2–released on Codeplex | TechPour.com

  12. Pingback: Katpro Technologies Pvt Ltd | JOPX on SharePoint, Big Data and the future of business!!!!!!

  13. Pingback: Katpro Technologies Pvt Ltd | JOPX on SharePoint, Big Data and the future of business!!!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: