Freitag, 8. März 2013

Building Search Driven Solution with SharePoint 2013 Part I

Part I is about Search Driven in on-premise environments
Part II will show the options and differences with O365 SharePoint Online
Search Driven Solutions are not new in SharePoint 2013. But with SP2013 they reached a new dimension and there are much more out-of-the-box Webparts and options to work with content that is in your search index.

Admin Stuff

Why to use Search Driven? Good question. Let’s ask “why not”? The answer is the index latency. Search Driven Solutions are based on the search index and that means that the data freshness depends on the index freshness. With new feature Continuous Crawling and other solutions like Event Driven Crawling we can realize a really up to date index. Depending on you environment you can realize an index freshness in the scope of 2 minutes or so. Some other points in the context of Search Driven Solutions are:

·         Separate presentation from storage

·         Flexible and dynamic

·         Breaking down site collection boundaries

·         Eliminate large list thresholds

·         Allows flexible & dynamic publishing

 
Special Data means Special Search and special Search Results

Not in every case we have to choose between normal SharePoint Search and Search Result Webpart ore using Search Driven Solutions. There is a very useful and powerful option between. With SharePoint 2013 there are some new features. In the context of “Special Date means Special Search and special Search Results” we will now have a closer look on “Result Source” and “Query Rules”.
Result Source

Working with search based solutions mostly we start with a “Result Source”. Result Sources are places under Site Settings or if you would configure them for the complete farm in the search service application. A Result Source had some basic parameters:

Protocol: defines from where the results are coming
Type: focused between content and people search
Query Transformation: gives us the option to focus which data is shown in this Result Source using Search Syntax. Also we had the option using the Query Builder to define the Query Transformation.
To use a Result Source we had to configure search result Webpart to use this source. This is simply configured in the settings of the result Webpart:

Query Rules

Query Rules are used to manipulate search query. A Query Rule always based on a Result Source. That’s why we have to start with a Result Source. Query Rules are also based in the site setting ore in search service application. Working with Query Rules we had two main parameters.
1.       Query Condition: this parameter defines under which condition the Query Rules take effect.
To do this we had several options. The easiest way is “Query matches Keyword exactly”. But we also can use Termstore using the option “Query matches Dictionary exactly” This brings many powerful options. For example if you extend you Termset which is referred you not need to reconfigure you Query Condition. Also in Multilanguage environment this can be useful.
2.       Actions: The section configures what should happen if a Query matches.
We can configure a promoted result which is similar to Best Bets we know from SharePoint 2010 are we can place a Result Block.
Result Blocks are a new feature that allows us placing a separate block containing the data we configured based on our Result Source in top of the search result Webpart. Every Result Block can be configured using Query Builder. For example if you will use a special Result Block only showing pictures the configuration should be like this one:
·         Query: {subjectTerms} contenttype:image
·         Settings: Item Display Template -> Picture Item
Display Templates are also a new feature in SharePoint 2013. They allow us to use different visualizations based on content type or so. Details see here: LINK
As shown in this screenshot:
Bring all this together we can deliver special search for special data.
To get a result like this we had to configure a Result Source, based on this Query Rules and then use the Result Source in a search result Webpart. Detail Step by Step walkthrough is shown in the Webcast at the end of the post.
Search Driven Publishing Model
The above solutions are all based on a search query which had to be filled in a search box by a user or had to be configured as a “fixed keyword query” in the settings of the search result Webpart. Now let’s see how we can create dynamic pages showing content based on Search Querys using the new Webpart Family “Search Driven Content”.
As you can see there are preconfigured Webparts for different scopes. The context driven Webparts like “Popular Items” and “Recommended Items” are based on search analytics, user context and user activity. Other ones like “Pictures” or “Pages” containing a special visualization based on the contented type. The “Search Driven Content” Webparts can also be used to visualize search results based on a search query which is typed into a search box. All search Webparts can combined which each user. This is used configuring the following example:
Here you can see the “Search Driven Content” Webpart for Pictures. In the settings dialog the Display Template is configured to show “Picture on top, 3 lines on bottom”. Under Property Mappings you can choose which Managed Property are used to fill the lines. In the context of the shown Refiner Webpart “Refinement Target” is configured to the “Search Driven Content” Webpart Pictures. The binding is based on the Title of the Webpart.
 

Solutions based on the Search API

The Search API allows use building Apps ore other solutions based on the content coming from the search index. For more information about the SharePoint 2013 Search API look here: LINK
Here is a example based on my demo environment:
http://win-ful28kv4389/_api/search/query?querytext='contenttype%3Aorbeabike'
Using this query the result looks like this:
Using this XML we build a demo App showing the same data like in the above shown search result Webpart using the Result Blocks:
 
Webcast with hands on system demos:

 

2 Kommentare:

  1. Hey, Nicki!

    Do you know if there is any way to show more than 3 result blocks? It seems to be limited to that number for some reason.

    I've been trying for a while but can't find a solution nor a confirmation that it happens by design.

    Thanks!

    AntwortenLöschen