Developing Search-driven application in SharePoint 2013
-
Upload
sharepoint-project-conference-adriatics -
Category
Technology
-
view
1.436 -
download
0
description
Transcript of Developing Search-driven application in SharePoint 2013
![Page 1: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/1.jpg)
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013
SharePoint 2013 Search Based SolutionsMany ways to query SharePoint SearchDARKO MILEVSKI, NEXTSENSE
![Page 2: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/2.jpg)
sponsors
![Page 3: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/3.jpg)
http://darkomilevski.info
![Page 4: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/4.jpg)
Agenda• SharePoint 2013 Enterprise Search Overview
• Keyword Query Language Overview
• Developing Server Side Search• Managed Server Side Object Model
• Demo
• Developing Client Side Search• Managed Client Side Object Model
• Demo
• JavaScript Client Side Object Model
• Demo
• REST APIs
• Demo
![Page 5: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/5.jpg)
What about search?• Are you using Bing or Google?• If you are a Dev, how many times have you tried to
develop without using a search engine?• Was it good experience?• Are using Search in SharePoint?• Did you know that you can customize and develop over
the SharePoint Search?• Do you know about rich Search functionalities like
Managed Properties, Result Sources, Query Rules, Keyword Query Language, etc., ….
![Page 6: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/6.jpg)
SharePoint 2013 Enterprise Search• Search in 2010 + FAST Search Server• Single Search• Server vs. Foundation• No more Express edition
• Deprecated Features• SQL Full-Text Query syntax -> Keyword Query Language• Search Scopes -> Result Sources
• Search Schema• Managed Properties
![Page 7: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/7.jpg)
Search Schema• Query data according to their metadata• Crawled and Managed Properties• OOTB Managed Properties• Author, Write (Modified Date), Path, FileSize, FileExtension,
and more
• Create your own managed properties• Maps to your own site columns• Crawled properties created automatically with owa_ prefix• Managed at Search Schema at SA or Site Collection• Map Managed property with one or more Crawled properties• Recrawl after mapping properties
![Page 8: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/8.jpg)
Result Sources• Replaces scopes (now deprecated)• Narrowing results• One very good explanation what are Result
Sources “imagine that your search index is the cube in the image on the slide, where you have four result sources:• Result source 1: search results can come from the
entire cube.• Result source 2: search results can come only from
the Bs.• Result source 3: search results can come only from
the Cs.• Result source 4: search results can come only from
the Ds.
• Query Transformation• {searchTerms} path:http://intranet/sales
![Page 9: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/9.jpg)
Keyword Query Language (1)• A KQL query consists of one or more of the following
elements:• Free text-keywords—words or phrases• Property restrictions
• Free text keywords• Word• Phrase• Operators and wildcard• Ex: conference / adria* / …
• Property restrictions• <Property Name><Property Operator><Property Value>
![Page 10: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/10.jpg)
Keyword Query Language (2)• Use wildcard operator (*) to find more results
• i.e.: account* finds account, accounts, accountant, and accounting
• Use >, >=, <, <= operators to query results by date• i.e.: Write>=“1/1/2013”
• Query by managed property like author or title:• i.e.: Author:”Ian Peterson”• i.e.: Title:”Europe 2014”• i.e.: author:Shakesp*• i.e.: title:"Advanced Search“• i.e.: title:"Advanced Sear*“ - wildcard operator (*) in the query, and it is
supported only at the end of the phrase• i.e.: author:"John Smith" author:"Jane Smith“ = author:"John Smith" OR
author:"Jane Smith“• i.e.: author:"John Smith" filetype:docx = author:"John Smith“ AND filetype:docx
![Page 11: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/11.jpg)
SHAREPOINT SEARCH CENTER
![Page 12: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/12.jpg)
Developing SharePoint 2013 Search solutions
• Server Side or Client Side query execution• Scenarios in Demos: Searching Invoices• Narrow invoices by Result Source that search for certain
Content Type• Search by term or property restriction• Async query execution• Select Properties and Sorting• Results limit and Paging
![Page 13: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/13.jpg)
Server Side Managed OM Querying• Executed directly on the server• Used for full trust code• Use KeywordQuery class with SearchExecutor class• Use KQL for query text• Iterate ResultsTable of type RelevantResults
![Page 14: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/14.jpg)
SERVER-SIDE OM SEARCH
![Page 15: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/15.jpg)
Managed Client Side Object Model (CSOM)
• SharePoint Managed Client Side Object Model classes• Very similar classes and code like server side managed
object model• Familiar programming from CSOM back in SP2010• Use ExecuteQuery• Select Properties• Selecting Custom Managed Properties
• Sort List
![Page 16: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/16.jpg)
MANAGED CLIENT-SIDE OBJECT MODEL SEARCH
![Page 17: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/17.jpg)
JavaScript CSOM Search• JavaScript in SharePoint 2013 is derived from the .NET
server programming model, and the programming capabilities defined here reflect those found in the original .NET server source.• Reference .js files
• <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>• <script type="text/javascript" src="/_layouts/15/sp.js"></script>• <script type="text/javascript" src="/_layouts/15/sp.search.js"></script>
• Use ExecuteQueryAsync(OnSucess,OnFail)• Using Result Source
• Query Only Documents of certain Content Type• Sorting
• Search Paging
![Page 18: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/18.jpg)
CLIENT-SIDE SEARCH FROM JAVASCRIPT
![Page 19: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/19.jpg)
SharePoint 2013 REST APIs• SharePoint 2013 adds the ability to remotely interact
with SharePoint sites by using REST• Construct a RESTful HTTP request, using the Open Data
Protocol (OData) standard• Response is either Atom or JSON
![Page 20: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/20.jpg)
Search REST APIs• [site]/_api/[name of SP API]/[name of operation]?
[parameters]• http://intranet/_api/search/query?querytext='invoice'
Operation Sample REST URL
Use a search Result Source (i.e. a scope)
/_api/search/query?querytext='search term'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'
Specify a start row (i.e. in paging)
/_api/search/query?querytext='search term'&startrow=11
Specify a number of results to return
/_api/search/query?querytext='search term'&startrow=11&rowlimit=10
Specify particular (managed) properties to return
/_api/search/query?querytext='search term'&selectproperties='Author,Path,Title,Url'
![Page 21: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/21.jpg)
REST search calls• Create HttpWebRequest • Await for HttpWebResponse and the Load
ResponseSretam• Result parsing• OAuth authentication for remote apps
![Page 22: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/22.jpg)
REST
![Page 23: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/23.jpg)
Why to use Search in solutions• Site Collections consolidation• Security Trimming (Custom Security Trimming)• Fast query results• High Availability and Load Balancing
Pros Cons
• Search Features• Programmability possibilities• Fast results• Use refiners• Querying Index on disk, not in
SQL
• Time from data entry till crawl• Additional space on disk
![Page 24: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/24.jpg)
questions?
HTTP://DARKOMILEVSKI.INFO
@DARKOMILEVSKI
i
![Page 25: Developing Search-driven application in SharePoint 2013](https://reader033.fdocuments.net/reader033/viewer/2022061120/54662e89b4af9f5d3f8b52fd/html5/thumbnails/25.jpg)
thank you.
SHAREPOINT AND PROJECT CONFERENCE ADRIATICS 2013
ZAGREB, NOVEMBER 27-28 2013