SharePoint 2013 Search – A Developer’s Perspective
Download
Report
Transcript SharePoint 2013 Search – A Developer’s Perspective
SHAREPOINT 2013 SEARCH – A DEVELOPER’S
PERSPECTIVE
Ryan McIntyre
MCITP, MCPD
Director, Portals & Collaboration
LEAVE NOW…OR…
• SharePoint 2013 Search Overview
– Changes from 2010
• Search Solutions
• OOTB Web Parts Review
• API
– Server side
– Client side
SCENARIOS
2013 SEARCH INTRO
Powerful Engine
FAST
Index
FS4SP
2010
Search
2013
Search
2013 SEARCH ARCHITECTURE
Public API
Unit of scale/role boundary
HTTP
File shares
SharePoint
User profiles
Lotus Notes
Documentum
Exchange folders
Custom - BCS
SharePoint
SP Apps
Devices
Non-SP UX
CORE BUILDING BLOCKS
• Content Source
• Search Schema
– Now available through site
administration
• Query Rule
– Customization of returned
results
– Captures Intent, composed of
• Query Condition
• Query Action
• Publishing Options
CORE BUILDING BLOCKS
• Query Transforms
– Web Parts (3)
– Query Rule (2)
– Result Source (1)
• Result Source
– Scope +
– Federated +
• CSWP
CORE BUILDING BLOCKS
• Result Type
– How to display types of
results
• Display Templates
–
–
–
–
CSWP
Hover Panel
Refiner
Search Results
SEARCH EXPERIENCE
EXECUTING QUERIES
EXECUTING QUERIES: KQL
EXECUTING QUERIES: REST
Keywords
http://server/site/_api/search/query?querytext='{KQL Query}‘
Selecting Properties
http://server/site/_api/search/query?querytext='test'&selectproperties='Title,Ran
k'
Sorting
http://server/site/_api/search/query?querytext='test'&sortlist='LastModifiedTime:
descending'
http://server/site/_api/search/query?querytext='test'&sortlist='LastModifiedTime:
descending,Rank:ascending
EXECUTING QUERIES: REST
<d:RelevantResults m:type="Microsoft.Office.Server.Search.REST.RelevantResults">
<d:RowCount m:type="Edm.Int32">16</d:RowCount>
<d:Rows m:type="SP.SimpleDataTable">
<d:Rows>
<d:element m:type="SP.SimpleDataRow">
<d:Cells>
<d:element m:type="SP.KeyValue">
<d:Key xml:space="preserve">Rank</d:Key>
<d:Value xml:space="preserve">29.4688339233398</d:Value>
<d:ValueType xml:space="preserve">Edm.Decimal</d:ValueType>
</d:element>
EXECUTING QUERIES: CSOM
ClientContext ctx = new ClientContext("http://sharepointonline/site");
var query = new KeywordQuery(ctx, ctx.Site);
query.QueryText = "Search terms";
query.ResultTypes = ResultType.RelevantResults;
query.Id = Guid.NewGuid();
var queries = new KeywordQuery[1];
queries[0] = query;
SearchExecutor searchExecutor = new SearchExecutor(ctx);
var rcc = searchExecutor.ExecuteQueries(queries);
ctx.ExecuteQuery();
QUERY DEBUGGING
CSWP & DISPLAY TEMPLATE DEPLOYMENT
CSWP DEVELOPMENT & DEPLOYMENT
• <cringe>Design in UI</cringe>
• Export
• Visual Studio solution
– Create “host” page
– Add markup for CSWP from export
– Properly escape ‘{‘, ‘}’, and quotes in DataProviderJSON property
DISPLAY TEMPLATE DEVELOPMENT &
DEPLOYMENT
• Create HTML file and verify results in UI
• Export JS
• Visual Studio solution
– Include JS
– Deploy to “_catalogs/masterpage/Display Templates/Content
Web Parts”
– {Optionally, deploy HTML (not JS) and programmatically update
file post-deployment to generate JS}
DEPLOYMENT DEMO
SCENARIOS
Ryan McIntyre
[email protected]
http://blog.randomdust.com
@ryanmcintyre
303-520-6337
RESOURCES
• http://sp2013searchtool.codeplex.com/