Friday, 6 November 2015

Search in SharePoint 2013



1.       Introduction
Search is an important out of box feature of SharePoint. In SharePoint whenever you search something, SharePoint looks into ResultSource. ResultSource is a location to get search results from, and to specify a protocol for getting those results. As a SharePoint Online administrator, you can specify how search should behave for a site collection or a site. The shared Search Box at the top of most pages will use these search settings. Any settings you specify on site collection level will apply to all sites within that site collection, unless you specify other settings for the site.

2.       SharePoint 2013 Search Settings at Site level

If we specify search behaviour at site level, it will be applicable only to that site. If you want to apply it to all sites of site collection, we need to configure at site collection level and to apply to all site collections configure at admin level. Here we will see how to configure search at site level and how to set it in drop down of search box.

We configure following settings to configure search
·         Result source
·         Result type
·         Query result
To configure at site level, you will find above option under search in site settings (Figure 1)

[Figure 1]

Now let’s see how to configure each of the above options.



3.       Result Source:
When we search in SharePoint, search system associate query with result source to provide result. Followings are the ResultSource used as drop down to search in SharePoint 2013.


Search types
Result Source
Description
Everything
Local SharePoint Results
All items from the local SharePoint search index except People items
People
Local People Results
People items from the profile database of the User Profile service application
Conversations
Conversations
Discussions in microblogs, newsfeed posts, and community sites

  


[Figure 2]


Ø Configure Result Source:
ü  Go to Site settings
ü  On the Site Settings page, in the Search section, click Result Sources [refer Figure 1].
ü  On the Manage Result Sources page, click New Result Source.
ü  On the Add Result Source page, in the General Information section, do the following:
§  In the Name box, type a name for the result source.
§  In the Description box, type a description of the result source.
ü  In the Protocol section, select one of the following protocols for retrieving search results:
§  Local SharePoint, the default protocol, provides results from the search index for this Search service application.
§  Remote SharePoint provides results from the index of a search service in another farm.
§  OpenSearch provides results from a search engine that uses the OpenSearch 1.0/1.1 protocol.
§  Exchange provides results from Exchange Server 2013 through a SharePoint 2013 eDiscovery Center.
ü  In the Type section select one of the following:
§  In the previous step, if you selected either Local SharePoint or Remote SharePoint for the protocol, then in the Type section, select SharePoint Search Results to search the whole index, or select People Search Results to enable query processing that is specific to people search.
§  If you selected Remote SharePoint for the protocol, then in the Remote Service URL section, type the address of the root site collection of the remote SharePoint farm.
§  If you selected OpenSearch 1.0/1.1 for the protocol, then in the Source URL section, type the URL of the OpenSearch source.
§  If you selected Exchange for the protocol, then in the Exchange Source URL section, type the URL of the Exchange web service.


[Figure 3]

ü  In the Query Transform section, do one of the following:
§  Leave the default query transform (searchTerms) as is. In this case, the query will be unchanged since the previous transform.
§  Use the Query Builder to configure a query transform by doing the following:
§  Click Launch Query Builder.
§  In the Build Your Query dialog box, optionally build the query by specifying filters, sorting, and testing on the tabs as shown in the following tables.




Basic Tab:

Property filter
You can use property filters to query the content of managed properties that are set to queryable in the search schema.
You can select managed properties from the Property filter drop-down list. Click Add property filter to add the filter to the query.
Keyword filter
You can use keyword filters to add pre-defined query variables to the query transform. You can select pre-defined query variables from the drop-down list, and then add them to the query by clicking Add keyword filter.













Sorting Tab:

Sort results
In the Sort by menu, you can select a managed property from the list of managed properties that are set as sortable in the search schema, and then select Descending or Ascending. To sort by relevance, that is, to use a ranking model, select Rank. You can click Add sort levelto specify a property for a secondary level of sorting for search results.
Ranking Model
If you selected Rank from the Sort by list, you can select the ranking model to use for sorting.
Dynamic ordering
You can click Add dynamic ordering rule to specify additional ranking by adding rules that change the order of results within the result block when certain conditions are satisfied.











TEST tab

Query text
You can view the final query text, which is based on the original query template, the applicable query rules, and the variable values.
Query template
You can view the query as it is defined in the BASICS tab or in the text box in the Query transform section on the Add Result Source page.
Query template variables
You can test the query template by specifying values for the query variables.










For example refer below figure: Here we have filtered result by pdf file type.

[Figure 4]

ü  On the Add Result Source page, in the Credentials Information section, select the authentication type that you want for users to connect to the result source.





Ø Specify a result source to use for query:
A query is initially associated with a result source according to the search experience in which the user performs the query. For example, if a user clicks People below a search box (see the screen shot earlier in this article) to specify the People search experience, the query uses the "Local People Results" result source.
A Search Box is always associated with a particular Search Results. When a user types a query in a search box, the Search Box sends the query to the associated Search Results. That Search Results specifies the result source for the query; by default, this result source is "Local SharePoint Results". You can set a different result source as the default.  To do this On the Manage Result Sources page, point to the result source that you want to set as default, click the arrow that appears, and then click “Set as Default”.



4.       Result Types:
When you search for something on a SharePoint site, very often many search results are returned. By default, the search results are displayed differently so that you can easily differentiate between the different types of search results. For example, just by glancing, you can see that the search results are PowerPoint presentations, Word document, and so on.
To display search results differently like this, search results are sorted into result types. A result type is a classification of a search result. For example, if a search result is found in a Microsoft PowerPoint presentation, the search result belongs to the Microsoft PowerPoint result type. If a search result is found in a PDF file, the search result belongs to the PDF result type.

Create and configure a custom search result type
1.        Go to the Manage Result Types page by doing one of the following:
o    If you want to create a result type for a site collection:
a.        Ensure that you are an administrator for the site collection.
b.       In the site collection, go to Settings > Site settings, and then in the Site Collection Administration section, click Search Result Types.
o    If you want to create a result type for a site:
a.        Ensure that you are a site owner for the site.
b.       On the site, go to Settings > Site settings, and then in the Search section, click Result Types.
2.        To create a result type, Click New Result Type.
  1. On the Add Result Type page, in the General Information section, in the Give it a name text box, type a name for the new result type.
  2. On the Add Result Type page, in the Conditions section, do the following:
    • In the “Which source should results match?” drop-down list, select a result source such as All Sources or Documents. For any given search result, this condition will be met if the search result is from the result source that you selected from this drop-down list or you can select result source to which you want to apply this result type.
    • (Optional) In the “What types of content should match?” drop-down list, do the following:
      1. Select a type of content, such as Microsoft Word.
      2. As many times as appropriate, click Add Value and select another type of content.
  3. (Optional) On the Add Result Type page, expand the Show more conditions section, and then do the following:
    • In the “Which custom properties should match?” section, the items in the “Select a property” drop-down list are retrievable managed properties. Select a property that you want the search system to perform a match on, such as Author.
    • In the second drop-down list, specify the operator, such as “Equals any of”.
    • In the text box, specify the value against which the search system should search for a match.
Separate multiple values with semicolons. Alternatively, as many times as appropriate, click Add Value and type another value in the new text box that appears.
For example, if you select the Author property and you select the operator Equals any of, then if you specify multiple values such as Kara and Silas, the condition will be “author equals Kara or Silas”.
    • To add another property to match, click Add Property.
  1. On the Add Result Type page, in the Actions section, do the following:
    • In the “What should these results look like?” drop-down list, click a display template such as Office Document Item or PDF Item. Display templates for search results are in the Search folder in the master page gallery for the site collection. The Display template URL box automatically displays the URL of the display template that corresponds to the display template that you selected.
    • Select the Optimize for frequent use check box if you expect this result type to appear frequently in search results.





5.        Query Rule:
In a query rule, you specify conditions and correlated actions. When a query meets the conditions, the search system performs the actions to improve the relevance of the search results.
For example, you might specify a condition that checks whether the query matches a term in a SharePoint term set, or another condition that checks whether the query is frequently performed on a particular search vertical in your search system, such as Videos.
A query rule can specify the following three types of actions:
ü  Add Promoted Results that appear above ranked results
ü  Add one or more groups of results, called result blocks. A result block contains a small subset of results that are related to a query in a particular way. Like individual results, you can promote a result block or rank it with other search results.
ü  Change the ranking of results. For example, for a query that contains “download toolbox”, a query rule could recognize the word “download” as an action term and boost search results that point to a particular download site on your intranet.






               





               
Before Search Customization:


After Search customization:







Adding your Custom result source to search box:


     









         
  • Insert web part: Search->search Result






3.              Edit web part:






  •  Change query: Add created result source









After you done check it in and publish the draft


  • Add page to search setting: Go to Site settings->Search setting under search.




  • In Configure Search Navigation click on “Add Link” (If Everything, Video, People and Conversation is not already present add them too) add URL of the page you created.




                Click OK.      


                Now you can see in the below figure that result source you created is added to search box









No comments:

Post a Comment