another technical blog...technically

Monday, June 8, 2015

Targeting contents using XRANK in SP2013 problem

Lately i had to create a content priority/targeting system in SharePoint 2013, using search capabilities in a public context (so no target audience available).
What you'll find below it's a targeting system based on managed metadata content tagging and dinamically generated queries using XRANK directives.
Let's think about a enterprise model with a hierarchy like this
  • Channel 1 (00000000-0000-0000-0000-000000000100)
    • Network 1 (00000000-0000-0000-0000-000000000110)
      • Agent 1 (00000000-0000-0000-0000-000000000111)
      • Agent 2 (00000000-0000-0000-0000-000000000112)
    • Network 2 (00000000-0000-0000-0000-000000000120)
    • ...
    • Network n (...)
  • Channel 2 (00000000-0000-0000-0000-000000000200)
  • ...
  • Channel n (...)
This could be represented as a hierarchical term set in Managed Metadata Service Application.
Now, let's assume we have these contents:
  • Page A, tagged with "Channel 1"
  • Page B, tagged with "Network 1"
  • Page C, tagged With "Agent 1"
Following this article http://techmikael.blogspot.it/2014/03/s15e01-kql-basics.html we can target contents using Search.
For example, if i am "Agent 1" and i want to obtain contents in this order
  1. Page C
  2. Page B
  3. Page A
i can use a query like this
(((owstaxIdTargeting:"GP0|#00000000-0000-0000-0000-000000000100" XRANK(cb=1))
owstaxIdTargeting:"GP0|#00000000-0000-0000-0000-000000000110" XRANK(cb=10))
owstaxIdTargeting:"GP0|#00000000-0000-0000-0000-000000000111" XRANK(cb=100))


Basically, i'm boosting contents created for "Agent 1", then contents for "Network 1", then "Channel 1".
Great? No. This method apparently works.
In this query i used XRANK, which boost the rank score... boost means SharePoint assign a score using ranking models you can boost manually using XRANK query directive.
This also means that rank scores could be scrambled by a lot of rank model rules, take a look to this articles:
This leads me to think i can create a "Fake ranking model" for those queries, useful only for this content targeting technique.
This model basically assigns a 0 score to all contents and it simply does NOTHING, so only XRANK values will be considered.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<rankingmodel2stage description="A model with does nothing" id="05E6223C-C4C0-4EB7-8E28-8242E48D05A9" name="Fake Rank Model" xmlns="urn:Microsoft.Search.Ranking.Model.2NN">
 <rankingmodel2nn id="242B7953-A3EE-499B-B6F5-A473AA33ADFA">
  <hiddennodes count="1">
   <thresholds>
    <threshold>0</threshold>
   </thresholds>
   <layer2weights>
    <weight>0</weight>
   </layer2weights>
  </hiddennodes>
  <rankingfeatures>
  </rankingfeatures>
 </rankingmodel2nn>
</rankingmodel2stage>
You can install this rank model on SharePoint farm and use it in your search based query (programmatically and/or in content search query web part).
Share:

Related Posts:

0 commenti:

Post a Comment

Because of a lot of SPAM about courses, I need to moderate all comments here.
I ensure you that I will answer whenever possible (if you are not a spammer).

Me, myself and I

My Photo
I'm just another IT guy sharing his knowledge with all of you out there.
Wanna know more?