Share point – client search api’s
Upcoming SlideShare
Loading in...5
×
 

Share point – client search api’s

on

  • 36 views

Small presentation on the client search API's available which I did for my team at DNVGL.

Small presentation on the client search API's available which I did for my team at DNVGL.

Statistics

Views

Total Views
36
Views on SlideShare
31
Embed Views
5

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 5

http://www.slideee.com 5

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Share point – client search api’s Share point – client search api’s Presentation Transcript

  • Grokking search via CSOM/JSOM and REST Mikael Svenson August 22 2014 DNV GL © 2014 DRAFT August 22 2014 SAFER, SMARTER, GREENER SOFTWARE SharePoint – Client Search API’s 1
  • CSOM/JSOM  Client Side Object Model  JavaScript object model  http://msdn.microsoft.com/en-us/library/office/dn423226(v=office.15).aspx DNV GL © 2014 DRAFT August 22 2014 2
  • jQuery.ajax({ DNV GL © 2014 DRAFT August 22 2014 REST  http://msdn.microsoft.com/en-us/library/office/jj163876(v=office.15).aspx  Wrapper functions will help: http://www.skylinetechnologies.com/Blog/Article/2480/Using-the-SharePoint- 2013-Search-REST-API.aspx 3 url: webUrl + "/_api/search/query?querytext='SharePoint'&rowlimit=10", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, success: function (data) { var hitCount = data.d.query.PrimaryQueryResult.RelevantResults.TotalRows; var hitCountwithDuplicates = data.d.query.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates; var results = data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results; $.each(results, function () { $.each(this.Cells.results, function () { var propertyName = this.Key; var propertyValue = this.Value; }); }); /* get result blocks */ if (data.d.query.SecondaryQueryResults != null) { for (var i = 0; i < data.d.query.SecondaryQueryResults.results.length; i++) { var resultBlock = data.d.query.SecondaryQueryResults.results[i]; $.each(resultBlock.RelevantResults.Table.Rows.results, function () { $.each(this.Cells.results, function () { var propertyName = this.Key; var propertyValue = this.Value; }); }); } } }, error: function (data) { } }); View slide
  • SharePoint 2013 Search Query Tool  https://sp2013searchtool.codeplex.com/ DNV GL © 2014 DRAFT August 22 2014 4 View slide
  • Fiddler or similar to explore the JSON data DNV GL © 2014 DRAFT August 22 2014 5
  • Benefits of using CSOM  You can batch queries, optimizing query execution DNV GL © 2014 DRAFT August 22 2014 6
  • Batching with REST  Can be achieved using query rules and result blocks, but will limit the number of results per type to 10  That said, using a query rule with result blocks makes updates a lot easier if you need to change the search queries – Example: Intranet front page which shows – Top 4 articles – Top X blog posts – Latest user documents – etc DNV GL © 2014 DRAFT August 22 2014 7
  • Refiners with REST  Use the query tool  Specify the refiners you want returned  Pick values from the Refinement results table  Use the Refinement Token value and(ContentType:ǂǂ746578742f68746d6c3b20636861727365743d7574662d38,FileType:ǂǂ68746d6c)  The value is hex encoded and(ContentType:"text/html; charset=utf-8",FileType:html) DNV GL © 2014 DRAFT August 22 2014 8
  • Refiners in CSOM  Similar to REST, set the .Refiners property of the KeywordQuery object  Set the RefinementFilters property to add filters RefinementFilters.Add(<filter>)  http://techmikael.blogspot.no/2013/07/working-with-refiners-in-csomsharepoint. DNV GL © 2014 DRAFT html August 22 2014 9
  • Anonymous  Requires some configuration  http://msdn.microsoft.com/en-us/ library/office/jj163876(v=office.15).aspx#bk_AnonymousREST  Waldek Mastykarz is your man when it comes to anonymous and WCM  http://blog.mastykarz.nl/configuring-sharepoint-2013-search-rest-api-anonymous-  http://blog.mastykarz.nl/inconvenient-search-rest-api-anonymous-users/  http://blog.mastykarz.nl/debugging-setting-properties-anonymous-search-rest-queries/ DNV GL © 2014 DRAFT users/ August 22 2014 10
  • Questions? SAFER, SMARTER, GREENER DNV GL © 2014 DRAFT August 22 2014 www.dnvgl.com 11