Book Image

Learning Search-driven Application Development with SharePoint 2013

By : Johnny Tordgeman
Book Image

Learning Search-driven Application Development with SharePoint 2013

By: Johnny Tordgeman

Overview of this book

SharePoint 2013 feels like a of fresh air, offering many new features and changes over older versions. Among these new features is a completely revamped search engine. "Learning Search-driven Application Development with SharePoint 2013" is a quick-start guide to creating search-driven applications using the new and exciting features that have revolutionized the SharePoint enterprise search experience. "Learning Search-driven Application Development with SharePoint 2013" is a fast-paced, practical, hands-on guide to the world of enterprise search in SharePoint 2013. With step-by-step tutorials and real-world examples, this book will give you a head start creating fresh and exciting search-driven applications using SharePoint 2013's new search engine. "Learning Search-driven Application Development with SharePoint 2013" is an accelerated way to create search-driven applications for SharePoint 2013. By covering the basics first and gradually covering all search related topics, this book will be your guide through the world of SharePoint's enterprise search. Furthermore, you will learn how to use the powerful feature of Query Rules to create smart conditions that help respond to user's search queries intelligently. We will also discuss how to style search results and make them stand out, how to index external content so it will be searchable using SharePoint's powerful search engine, and how to use the new client side search APIs, which will allow us to take advantage of search in Apps, the new development model for SharePoint 2013. After reading Learning Search-driven Application Development with SharePoint 2013, you will understand what it takes to create applications that use search as a content provider. Using applications that are based on real world examples and step-by-step tutorials, you'll get hands-on experience in developing search driven applications.
Table of Contents (12 chapters)

New features of SharePoint 2013 Search


The SharePoint 2013 Search engine is the most powerful enterprise search engine Microsoft has created to date. With this new release, Microsoft combined all of the best features of the legacy SharePoint Enterprise search engine with the best features of the FAST search engine, which Microsoft acquired back in 2008.

The new features of SharePoint 2013 Search can be divided into four main categories as follows:

  • Search administration

  • UI changes and customization

  • Relevance and ranking features

  • New development methods

Search administration

One drawback of search in previous versions of SharePoint was that almost everything had to be managed from the central administration page, which meant that search was managed at the farm level.

SharePoint 2013 changed that by adding most of the search settings from the farm level to site collections and sites (SPWebs). As SharePoint 2013 is offered as a cloud service (through Office 365), and cloud users have no access to settings in the farm-administration level, this was a welcome change that both cloud and on-premise site administrations can take advantage of.

Let's have a look at what settings are available for us to administrate; these are shown in the following screenshot:

We will discuss these settings in detail in Chapter 2, Using the Out of the Box Search Components, but for now just keep in mind that a site administrator can configure the search experience on his/her site in ways that were reserved exclusively to farm administrators in previous versions.

In addition, Microsoft introduces a new crawling mode, continuous crawl. Continuous crawl helps to keep the search index as fresh as possible by crawling SharePoint sites (and only SharePoint sites) every 15 minutes, by default; we can change this value using PowerShell, as shown in the following snippet:

$ssa = Get-SPEnterpriseSearchServiceApplication
$ssa.SetProperty("ContinuousCrawlInterval",<minutes>)

The value we use for <minutes> is the number of minutes between crawling.

When running, the crawler gets changes from the crawled SharePoint sites and pushes them to the content processing component, which will process the new content on the fly.

By enabling the continuous crawler, items appear in the search almost immediately after being crawled.

UI changes and customization

If there is one change in SharePoint 2013 Search that just pops to the eyes, it is the new and fresh user interface (UI). If you worked with SharePoint 2010 search, you'll remember the following screenshot, showing a search-results page:

By looking at the preceding screenshot, we can see that it sports a pretty simple UI. We have textual refinements on the left side; predefined search scopes for websites and people (All Sites and People) on top, and a main, simply styled results area without grouping or categorization of results.

To customize the way the results are shown, we had to use XSL/XSLT, which is quite a messy and unattractive way to design.

Fast forward to the present day. The following screenshot displays how the results page looks like in SharePoint 2013:

Now that's quite different, isn't it? The UI is modern thanks to the use of HTML and JavaScript templates. Instead of messing around with XSLT, we now have display templates to design our results using languages we already know and love: HTML, JavaScript, and CSS.

Take a look at the refinement panel on the left. While we still have textual refiners, we also have graphical ones, such as a scroller for dates.

We have new out-of-the-box search scopes—Videos and Reports—and results are grouped by their types; for example, the first two results are discussion items from a discussion board.

The biggest and most notable change, however, is the new hover panel. Whenever we hover over a search result, we are presented with a floating panel containing additional information about the hovered item. As SharePoint 2013 seamlessly integrates with Office web apps, any Office document we hover over will show a preview of its content in the new hover panel. The most important thing about the hover panel, however, is that we, as developers, have complete control over the content of this hover panel. Just like search results, the hover panel is also controlled by HTML, CSS, and JavaScript.

We will discuss all of these new and exciting customizations features in detail in Chapter 4, Customizing the Look.

Relevance and ranking features

As mentioned earlier, SharePoint 2013 Search took the best features of SharePoint Search and FAST and improved them. As such, SharePoint 2013 uses new and improved ranking models to determine which items are to be displayed and what would be their rank (the order in which they are displayed).

The key to successfully determine the relevancy of search results is to satisfy the intent of the person who issues the query. Let's explain this statement with an example; say I'm performing a search for Apple. Now, did I search for apple the fruit or Apple the technology company?

SharePoint 2013 Search continuously tracks and analyzes search usage to determine how content is connected, how often an item appears in search results, and which search results people click in order to continuously improve the relevance of items to the search query. So, if I clicked on a lot of fruit-related results, the search engine will assume I was looking for apple the fruit, and not the technology company.

We will discuss these new features in Chapter 2, Using the Out of the Box Search Components, and Chapter 3, Using the New CSOM and RESTful APIs.

New development methods

With this new release of SharePoint, Microsoft made changes to the search-development model. The old SOAP web service (ASMX) has been deprecated alongside the SQL query syntax that we could use to query against SharePoint data.

But, just like the the old saying goes, "out with the old and in with the new", we get some new features to play with to replace the ones that are gone.

  • A new C lient Side Object Model (CSOM) object which enable us to access the search service using JavaScript and C#. With the help of the search CSOM, we can create search-driven applications even for servers that don't have SharePoint 2013 installed on them.

  • A dedicated Representational State Transfer (REST) service that enables us to execute queries against the search service from client applications using libraries such as jQuery or RestSharp. The REST service supports all of the properties available in the CSOM object, but instead of working against objects, we use the URL's query string to send parameters to it.

  • An enhanced keyword query language with new and improved operators such as ONEAR and XRANK.

  • Enhancements to the Business Connectivity Services Connector Framework, which improves capturing and logging of exceptions to help us troubleshoot errors during the crawl process.

We will discuss all of these topics in detail in Chapter 3, Using the New CSOM and RESTful APIs, and Chapter 5, Extending Beyond SharePoint.

Now that we have a general idea about what's new in SharePoint 2013 Search, let's go ahead and discuss the architecture that makes all of this happen.