Saturday, October 4, 2014

Office Graph support in the SharePoint 2013 Search Query Tool

I just compiled v2.2 of the SharePoint 2013 Search Query Tool which has one major new function: Support to query the Office Graph in Office365 using GQL (Graph Query Language). Many thanks to Barry Waldbaum @ Microsoft for starting the work on this feature, and the joint effort to bring it into the tool.

If you choose SharePoint Online as the authentication method, you will see a couple of extra fields in the tool:

  • Graph Query
  • Graph Ranking

image

If you specify Graph Ranking, the tool will also automatically add 0c77ded8-c3ef-466d-929d-905670ea1d72 as the ranking model id as specified in the MSDN documentation.

If you don’t have a particular query to run, pass in * as your query text, and using REST you get a calling URL like this:

https://delve.sharepoint.com/_api/search/query?querytext='*'&properties='GraphQuery:ACTOR(ME\, action\:1020),GraphRankingModel:{"features"\:[{"function"\:"EdgeWeight"}]}'&rankingmodelid='0c77ded8-c3ef-466d-929d-905670ea1d72'

If you look at the network trace from Delve you can see queries like the ones below, which are now easy to test.

and(actor(me,action:1003),actor(me,or(action:1003,action:1036,action:1037,action:1039)))

and(actor(me,action:1021),actor(me,or(action:1021,action:1036,action:1037,action:1039)))

The tool will do all the encoding for you and construct the properties part of the query. For your results you will get back a managed property named Edges, which contain information about the link between the actor and the object, all pretty printed for your pleasure!

image

I have plans to add helpers to transform the action codes to a readable names which makes it easier to write GQL, so watch out for this in the future.

Happy GQL’ing!