Let’s Build a Search-Based Application in SharePoint 2013 Baltimore SharePoint User Group July, 2013 Matthew J. Bailey Session Agenda What used to take days or weeks to program can now be done with simple Query Rules, Result Sources, Promoted Results & other new features of SharePoint 2013 search. See how we can create a functional, multi-media based search experience based on the user's needs and intended results. Topics we going to cover in this session: • What is a search-based application? • New features of SharePoint 2013 search • Solve a real world (sort of ) business case scenario with search related functionality Matthew J. Bailey, MCTS SharePoint Business Analyst & IT Project Manager JDSU I consider myself a “SharePoint All-Rounder”. My job tasks vary from Administration, Development, Training, Analyst, UAT and Project Management. My job changes daily based on the crazy life of an IT fellow in corporate America, but it keeps things interesting! I am not an expert with SharePoint search and have not worked FAST too much, however I have worked with SEO, search analytics and design and SharePoint in general for several years. If I don’t know an answer to one of your questions, I will try to find out or point you in the right direction! Oh, did I mention my “dry” sense of humor? No worries, you’re about to experience it while learning SharePoint at the same time Special thanks to… • Eric Harlan for helping me with my presentation setup on Azure • http://www.ericharlan.com/ Other notes… • Search in SharePoint 2013 is powerful. Simple, yet complex. There is far more than what I will discuss today available to you. It is more than I can cover in one demo but I hope it is enough to peak your interest in it. What is a Search-Based or Search Driven Application? There are various definitions: • Using search as a data access technology. This is less about the UI and more about the concept of using search features, queries and indexes to retrieve your data. • Using search as the interface. This concept is more along the lines of presenting the user a web page that looks more like a search experience, whether it be a basic search with type-ahead features or a multiple field advanced search type of concept. • Extending the existing search center. ADD MORE HERE TO BE CONSISTENT • Adding URLs that have search queries in them. ADD MORE HERE TO BE CONSISTENT Benefits of Search-Based or Search Driven Applications • Less risk, no code deployments vs. configurations • Easier to troubleshoot issues with results than code • Must faster than coding • More dynamic, flexible to gather and manipulate data What I got… What I wanted… Why do I love search in SharePoint 2013 sooooooooo much? • • • • • • • • • • Intent based Dynamic improvement Ease of use Massive flexibility Visual Interest Multimedia/format Huge productivity increases/time savings All of the expensive features that use to be in FAST are now free Makes me look good to my boss when I create awesome searches I can make it be exactly what I WANT! (is this all about control? Enquiring minds would like to know…) No one even paid me to say this! My Development Environment • • • • Running on Windows Azure 3 VMs – 1 AD, 1 SQL, 1 SP Configured with very high performance settings Do not have Office Web Apps installed, but will show an example of how this functions from my Office 365 account. *NOTE: Make sure to check out my link at the end of the presentation where I have included a list of several options to create your own SharePoint 2013 “playground” if you do not have one. Business Case There is always something going on at inCogNeato. Productivity is down, morale and employee motivation are low, profit margins aren’t high enough, we aren’t meeting our new client goals, operating costs are too high, etc. Frankly speaking, the cog business just isn’t what it use to be. Hugh Jordeal (Executive Director Manager Supervisor) has held an important meeting discussing changes we need to make immediately in regards to the launch of the product that will save the company, the “NewCog5000”. Hugh has assigned certain tasks to some employees that need to be accomplished “pronto”. Unfortunately, no one is sure how to meet the lofty goals assigned and complaints are coming in to the help desk that no one can find anything on the intranet to do their job. Word makes it up to Hugh and IT gets a call that someone better fix the intranet or else. IT needs to whip up an application to help everyone out, and as usual, it was due yesterday. No worries, I’ve got it all figured out (I think). What are Our Requirements and/or Issues? • People are seeing incorrect results or cannot find items that are there. • People cannot find what they are looking for and some people are searching for things they shouldn’t be • People don’t know how to search, need guidance or do not know some things are there. • Important and related data is spread all over due to lack of governance. • Experience is very lackluster, uninspiring, unmotivating. What are Our Solutions? • People are seeing incorrect results or cannot find items that are there. Continuous Crawl • People cannot find what they are looking for and some people are searching for things they shouldn’t be. Result Sources & Query Rules • Don’t know how to search, need guidance and don’t know some things are there. Search Verticals & Refinement Panel • Important and related data is spread all over due to lack of governance. Content Search Web Part • Experience is very lackluster, uninspiring, unmotivating. Design Manager / Display Templates Issue People are seeing incorrect results or cannot find items that are there. Solution Continuous Crawl • It is available only for content sources that use the SharePoint Sites content source type. • Set intervals: The default interval is 15 minutes, but you can set continuous crawls to occur at shorter intervals by using Windows PowerShell. • Continuous crawls ensure content freshness: Unlike full and incremental crawls, multiple continuous crawls can run at the same time. For example, if one continuous crawl is processing a large update, another continuous crawl can start at the same time and crawl and index other content updates. • Very resource intensive, need to plan for an architecture to support this. • Once enabled, cannot be deleted but it can be disabled and/or re-enabled again. Demo Continuous Crawl Enable Continuous Crawl • As an Administrator for the Search service application, in Central Administration, in the Application Management section, click Manage service applications. • Click the Search service application. • On the Search Administration page, in the Quick Launch, under Crawling, click Content Sources. • On the Search Service Application: Manage Content Sources page, click the SharePoint content source for which you want to enable Continuous Crawl. • In the Crawl Schedules section, select Enable Continuous Crawls, click OK. • Verification: In the Search Service Application: Manage Content Sources page, verify that the Status column has the status Crawling Continuous. • To change the frequency of the Continuous Crawl schedule, run SharePoint 2013 Management Shell as Administrator, enter PowerShell script (the 1 is 1 minute): • $ssa = Get-SPEnterpriseSearchServiceApplication $ssa.SetProperty("ContinuousCrawlInterval",1) • More specifics and issues can be found at: http://sympmarc.com/2013/05/13/sharepoint-2013s-search-continuous-crawl-an-enigma/ Issue People cannot find what they are looking for and some people are searching for things they shouldn’t be. – Demonstration… Solution Query Rules Provides the ability to influence the search results by overriding the term the user entered to force it to go to a certain result. They are processed under certain conditions. They are composed of 4 items: 1. Context 2. Condition 3. Action 4. Publishing They are applied to a Result Source. They can also be applied at the site, site collection or service application level. *NOTE: If you want Query Rules to apply in all your websites and the search center, you should apply these at the web application level as the search center is actually a different site collection from your other sites. Demo Query Rules Apply Query Rules Assist users in finding what they need As an Administrator for the Search service application, in Central Administration, in the Application Management section, click Manage. • Select Query Rules • Add the Query Conditions • Select Result Blocks What does this do? Prevents users from finding what they don’t need • Create Query Rules to inform users of “inappropriate searches” • Create Query Rules to help users find relevant data or misspellings Hover Panel / Document Preview With a full Enterprise installation of SharePoint 2013, you need to have an Office Web Apps server for the document previews to work. This is enabled by default in Office 365 however. Due to the limitations of my demo environment I do not have this installation setup. How is this going so far? Too fast, too slow, too complex, too easy, too silly? Continuous Crawl Checkup Let’s go back and see if our information appears in search now • • • big expensive lunch order my limo to airport arrange my private jet Issue Important and related data is spread all over due to lack of governance. Solution Content Search Web Part (CSWP) Like a pre-built search query to provide search results. • More functional than a Content Query Web Part (CQWP) as it has more than 3 levels of criteria & can span SC • Can be offered to a “power user” to create meaningful results or be beneficial to a developer in a highly restricted, Change Management “heavy” environment • Offers refining, sorting, display options and much more with little or no code (well… KQL) *NOTE: The Content Search Web Part is only available in the Enterprise edition of an onpremise/full trust installation of SharePoint 2013. As a replacement, there is an option to use the Search Results web part instead which has almost all of the same features (but not quite). Check out Benjamin Niaulin’s link here: http://en.share-gate.com/blog/sharepoint-2013-content-search-webpart Issue Important and related data is spread all over due to lack of governance. Solution Content Search Web Part (CSWP) Like a pre-built search query to provide search results. • More functional than a Content Query Web Part (CQWP) as it has more than 3 levels of criteria & can span SC • Can be offered to a “power user” to create meaningful results or be beneficial to a developer in a highly restricted, Change Management “heavy” environment • Offers refining, sorting, display options and much more with little or no code (well… KQL) *NOTE: The Content Search Web Part is only available in the Enterprise edition of an onpremise/full trust installation of SharePoint 2013. As a replacement, there is an option to use the Search Results web part instead which has almost all of the same features (but not quite). Check out Benjamin Niaulin’s link here: http://en.share-gate.com/blog/sharepoint-2013-content-search-webpart Demo Content Search Web Part Configuring a Content Search Web Part 1. Configuring a Content Search Web Part 2. Explore Learning Keyword Query Language (KQL) To really make your applications “shine”, here are some popular terms to get you started: • XRANK – to assist with sorting • Wildcard * - to display variants of terms • Near - to display terms with slight variation (e.g. John vs. Jon) • ONEAR - http://msdn.microsoft.com/en-us/library/ee558911.aspx • ContentClass=STS_Web – a specific Content Type from SharePoint (web, events, tasks, etc.) These are good to get you started, but for more references check out these links: http://msdn.microsoft.com/en-us/library/hh644280(v=office.12).aspx http://msdn.microsoft.com/en-us/library/hh625658(v=office.12).aspx http://extreme-sharepoint.com/2011/10/28/sharepoint-keywordquery/ Just in Case You Bored… Have a look at some XRANK sorting algorithms, fun for the whole family! Search Verticals Link to anything but usually links to a custom search result page. The existing search verticals OOTB are: • An .aspx page with some search web parts • The Search Results web part configured to use a Result Source Demo Search Verticals Easily create your own Search Vertical with a Result Source: • Go to the Search Center pages library. • Copy a result page that already exists via Open in Explorer or SharePoint Designer. • Rename the page to something related to its purpose. • Edit the page and the Search Results web part and change the Search Criteria to a different Result Source (either one that already exists or a new one you created). • Save, check-in/publish the page. • Go to search center Site Settings Search Settings. • Add a navigation link to your new custom search result page, and save. Easily create a Search Vertical to other links: • Go to search center Site Settings Search Settings. • Add a navigation link to wherever you like, and save Refinement Panel Out of the box refiners provided, custom refiners available for adding from managed properties Demo Custom Refiners Adding refiners to the Refinement Panel web part in the Search Center You can use a built-in managed property or create your own to use as a refiner. Issue The interface is uninspiring and not standard to corporate design. The Graphic Design department is none too pleased… Solution Design Manager / Display Templates • Quickly use a pre-built template from the installed selections or import your own Design Package for a custom look. Display Templates (won’t go into but know they are there) • Display templates in SharePoint Server 2013 are templates used in Search Web Parts • They show the results of a query made to the search index. • Display templates control which managed properties are shown in the search results, and how they appear in the Web Part. • Each display template is made of two files: HTML file and .js file (use to be the xslt designer in 2010) • Only Search Web Parts can use display templates (i.e., Search Results, Content Search, Taxonomy Refinement) • http://msdn.microsoft.com/en-us/library/jj945138.aspx • http://www.youtube.com/watch?v=yC4LZapFdfY And so much more… • • • • • • All types of different rule variations All types of different ways to display results All types of concepts to personalize search per user All types of sorting on rules All types of queries using KQL All types of coding against the search object model/CSOM, from apps, against the index, etc. Now that we understand search in SharePoint 2013, everyone is a happy family… Feel free to connect: @matthewjbailey1 http://www.matthewjbailey.com http://www.linkedin.com/in/matthewjbailey1 sharepointmatthew@gmail.com Download my slides and get started at: http://www.matthewjbailey.com