Fives ways to query SharePoint 2013 Search - SharePoint Summit Toronto 2013

on

  • 12,271 views

Slides from my talk about the SharePoint 2013 Search API at SharePoint Summit Toronto 2013

Slides from my talk about the SharePoint 2013 Search API at SharePoint Summit Toronto 2013

Statistics

Views

Total Views
12,271
Views on SlideShare
12,271
Embed Views
0

Actions

Likes
2
Downloads
81
Comments
0

0 Embeds 0

No embeds

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

    Fives ways to query SharePoint 2013 Search - SharePoint Summit Toronto 2013 Fives ways to query SharePoint 2013 Search - SharePoint Summit Toronto 2013 Presentation Transcript

    • Five ways to query SharePoint2013 SearchCorey Roth - Infusion
    • www.sharepointsummit.orgCorey RothFrom Houston, TXPrincipal Architect at Infusion DevelopmentSP2 Apps for SharePoint 2013Three-time Microsoft SharePoint MVPSpecializing in ECM, Search, and apps2
    • www.sharepointsummit.orgContactE-mail: coreyroth@gmail.comTwitter: @coreyrothBlog: www.dotnetmafia.comApps: www.sp2apps.com3
    • www.sharepointsummit.orgKey TakeawaysUnderstanding Keyword QueriesQuerying from the ServerQuerying from the ClientChoosing the right API4
    • www.sharepointsummit.orgBack to BasicsBuilding Queries
    • www.sharepointsummit.org(Re)introducing the Keyword QueryLanguage (KQL)You’ve been using KQL and may not know itOOTB Search Box uses KQLSupports simple and advanced queriesRecommended query language for SharePoint
    • www.sharepointsummit.orgQuerying exactly what you wantUse OOTB Managed PropertiesAuthor, Write (ModifiedDate), Path, FileSize, FileExtension, and moreCreate your own managed propertiesMaps to your own site columnsCreated automatically now with owa prefixManaged at Search Schema at SA or Site CollectionRecrawl after mapping properties7
    • www.sharepointsummit.orgConstructing Keyword QueriesUse wildcard operator (*) to find more resultsi.e.: account* findsaccount, accounts, accountant, and accountingUse >, >=, <, <= operators to query results bydatei.e.: Write>=“1/1/2013”Query by author or title using built-in managedpropertiesi.e.: Author:”Christina Murphy”i.e.: Title:”Budget 2012” 8
    • www.sharepointsummit.orgHelpful Built-in Managed PropertiesManaged Property DescriptionAuthor Author of documentSite Used to query items by URLTitle Title of page or documentWrite Date document was modifiedIsDocument Set to 1 to return only documentsContentType Query by content type of item9
    • www.sharepointsummit.orgResult SourcesReplaces scopes (now deprecated)Several included OOTBEx: Documents, Popular, Recently Changed Items10
    • www.sharepointsummit.orgResult SourcesCan only be queried by Id (Guid) ScopeId KeywordIDs can only be retrieved via managed APIMost OOTB IDs are the same across farmshttp://tinyurl.com/b5bflbl11
    • DemoKeyword Queries12
    • www.sharepointsummit.orgTesting Queries EasilyNew query testing interface in SharePoint 2013Available in:Script Search Web PartContent Search Web Part13
    • DemoSearch Web Parts14
    • www.sharepointsummit.orgQuerying byQuery String
    • www.sharepointsummit.orgUsing the Query StringUse the k parameter to query searchConstruct keyword query in your own appLet SharePoint handle displaying resultsGreat for:Custom advanced search pagesQuerying from external apps
    • www.sharepointsummit.orgQuerying from fulltrust code
    • www.sharepointsummit.orgFull Trust Code – Server Object ModelUse KeywordQuery class for full trust solutionsMust execute directly on SharePoint farmUses same KQL syntax
    • www.sharepointsummit.orgKeywordQuery ClassSet query with KeywordText propertyUse new SearchExecutor class to queryFilter result tables with Filter()Great for:Managed Code on SharePoint farm19
    • www.sharepointsummit.orgKeywordQuery - Snippet20
    • DemoKeywordQuery21
    • www.sharepointsummit.orgQuerying fromthe ClientManaged CSOM22
    • www.sharepointsummit.orgManaged CSOMGreat for:Provider hosted appsRemote .NET Application
    • www.sharepointsummit.orgUsing Managed CSOMUses similar KeywordQuery andSearchExecutor classesRequires a client contextReferencesMicrosoft.SharePoint.Client.dllMicrosoft.SharePoint.Client.Runtime.dllMicrosoft.SharePoint.Client.Search.dll24
    • www.sharepointsummit.orgManaged CSOM – Code Sample25
    • DemoManaged CSOM26
    • www.sharepointsummit.orgQuerying fromthe ClientSearch Client Object Model
    • www.sharepointsummit.orgSearching with JavaScript CSOMUses similar KeywordQuery andSearchExecutor objectsResults easier to parse than RESTREST is still preferred method
    • www.sharepointsummit.orgJavaScript CSOM Code Sample29
    • DemoJavaScript CSOM30
    • www.sharepointsummit.orgQuerying fromthe ClientREST
    • www.sharepointsummit.orgRESTNew Search REST API addedAvailable at /_api/search/queryUse querytext parameter to queryEnclose query in single quotesExamplehttp://server/_api/search/query?querytext=’SharePoint’Test directly in the browser
    • www.sharepointsummit.orgREST + JavaScriptAssemble REST API URLInclude path to REST APIUse KQL in querytext parameterUse $.ajax() to execute queryInclude Headers: { “Accept”: “application/json; odata=verbose” }Retrieve search results from:data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.resultsGreat forApps and Web Parts33
    • DemoSearch using REST34
    • DemoREST API + JavaScript35
    • www.sharepointsummit.orgWhich API?API UseKeywordQuery (Server OM) Full trust solutions on SharePointKeywordQuery (Client OM) Provider hosted appsJavaScript + REST SharePoint-hosted Apps, remote applicationsJavaScript CSOM SharePoint-hosted Apps, Web Parts, etc.Web Services Never36
    • www.sharepointsummit.orgDeprecated /Obsolete Features
    • www.sharepointsummit.orgDeprecated / Obsolete FeaturesFAST Query Language (FQL) – deprecatedFull Text SQL Query - obsoleteSearch Web Services - deprecated
    • www.sharepointsummit.orgKey TakeawaysUnderstanding Keyword QueriesQuerying from the ServerQuerying from the ClientChoosing the right API39
    • www.sharepointsummit.orgResourcesQuery Search with the KeywordQuery Classhttp://tinyurl.com/c9q76leQuery Search with the Managed Client ObjectModelhttp://tinyurl.com/ckxhm8gQuerying Search with JavaScript CSOMhttp://tinyurl.com/d685a5gQuerying Search with JavaScript and RESThttp://tinyurl.com/dyhwvje40
    • Thank you for your attention!This presentation will be available on the TorontoSharePoint Summit web site a few days after the event.
    • Please rate this session!Fill out the survey and get a chance to win a Surface