Leveraging SharePoint 2013 Search and CSR

Post on 14-Aug-2015

222 views 0 download

Tags:

Transcript of Leveraging SharePoint 2013 Search and CSR

Leveraging SharePoint Search

In SharePoint 2013

Jameson Bozeman

Session Preview

Why SearchOut of the Box WinsQueries – Getting your ItemsManaged Properties – Getting your ContentDisplay Templates – Getting your Branding onCustom Solutions

Why Search2010 ScenarioContent Query Web parts

Limited ScopeResource HogHard to Modify Layout with XSLT

Why Search2013 ScenarioContent Search Web parts

Minimized SQL LoadMore control over QueriesEasy Control of Display using Client Side RenderingPull from across Site Collections

4 |

Out of the Box

5 |

DEMO

CSWP Concepts

6 |

QueryGet Items

Managed PropertiesUsable Columns from

Items

Display TemplatesMake it Pretty

Queries – KQL Syntax

KQL Syntax Reference - https://msdn.microsoft.com/en-us/library/office/ee558911.aspxToken Reference - https://technet.microsoft.com/en-us/library/jj683123.aspx

7 |

Result SourcesBenefits of Result Sources

Faster QueriesLess Server LoadSimplifies Advanced queries for Power UsersBetter Change Control

8 |

Managed Properties

Site Column Name Crawled Property Managed Property

Item Number Ows_q_TEXT_ProductCatalogItemNumber

ProductCatalogItemNumberOWSText

Group Number Ows_q_TEXT_ProductCatalogGroupNumber

ProductCatalogGroupNumberOWSTEXT

Rollup Image ows_r_IMGE_PublishingRollupImage

PublishingImage

Language Tag Ows_q_CHCS_ProductCatalogLanguageTag

ProductCatalogLanguageTagOWSCHCS

Title Title Title9 |

Crawled Property: Raw content extracted from crawls

Managed Property: Search web parts use to display content, consists of 1 or more mapped Crawled Properties

Managed Properties

10 |

How do Managed Properties get created?Managed Properties automatically created for Site Columns Column has Content in SharePoint List/LibraryFull CrawlSite Column Name

Crawled Property

Managed Property

Title Title Title

Item Number Ows_q_TEXT_ProductCatalogItemNumber

ProductCatalogItemNumberOWSText

Group Number Ows_q_TEXT_ProductCatalogGroupNumber

ProductCatalogGroupNumberOWSTEXT

Rollup Image ows_r_IMGE_PublishingRollupImage

PublishingImage

Language Tag Ows_q_CHCS_ProductCatalogLanguageTag

ProductCatalogLanguageTagOWSCHCS

Managed Properties

11 |

Managed Properties are now set under Search Schema in the Central Admin or Site Settings.

Searchable: Includes the content of the property in the index, making it searchable as a query term alone. Queryable: Property can be used in queries such as Property:Value. Retrievable: Property can be returned to the result set for display or programmatic usage.Refinable: Property can be returned in refiners. Sortable: Properties can be used for sorting.

Continuous Crawl

12 |

Increased Freshness and Managed Property Creation

Tip: Full Crawl is not required for Managed Property creation if Reindex List is selected and continuous crawl is turned on.

Manage Continuous Crawl Interval with Powershell (default 15 mins)

$ssa = Get-SPEnterpriseSearchServiceApplication

$ssa.SetProperty("ContinuousCrawlInterval",5)

$ssa = Get-SPEnterpriseSearchServiceApplication $ssa.SetProperty("ContinuousCrawlInterval",n)

Display Templates

13 |

Display Templates

14 |

Creating Display Templates

Start with copy of other OOTB HTML display template

Always edit HTML Display Template SharePoint generates the corresponding JS File automatically

CSWP Licensing

15 |

Content Search web parts are only included in SharePoint Enterprise or SharePoint Online

Tips: Search Results (in all versions of SharePoint) web parts can use most CSWP display templates.

Difference: Managed Properties need to be mapped out in the display template, no easy mapping in Web Part Settings.

Overriding Queries

16 |

Queries can be overridden for Search Web Parts using Client Side Code, without reloading page!

Example:Srch.ScriptApplicationManager.get_current().queryGroups['e77e5f8b-e52f-46d8-a04c-7f9d83284858'].dataProvider.set_queryTemplate('ContentType:"Document"')

 

Srch.ScriptApplicationManager.get_current().queryGroups['e77e5f8b-e52f-46d8-a04c-7f9d83284858'].dataProvider.issueQuery()

DEMO

Search Rest APIExample Rest URI: http://server/_api/search/query?querytext=’SharePoint’

Retrieve search results in JSON Format: data.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results

17 |

When not to use SearchPulling from a single location

Complex logic needed for filtering of items

Limited or failing SharePoint hardware

Need freshness of less than 5 minutes

18 |

Any Questions?