Configure Contexual Search

Configure CONTEXTUAL  Search
Before configuring it we need to understand the search basics about Result sources and Query Rules. There are some nice articles available on tech-net which explain these in detail:
Understanding result sources for search in SharePoint Server 2013

https://technet.microsoft.com/en-us/library/dn186229.aspx


Configure result sources for search in SharePoint Server 2013

https://technet.microsoft.com/en-us/library/jj683115.aspx


Once you go through above articles next requirement is to customize your overall search experience and setting up contextual search. I came across a nice thread which explain this in detail



SharePoint 2013 Search Spelling Suggestion

Search Query Suggestions and Search Spelling Suggestions. They are not the same!
Query Suggestions are offered while the user types in the search box. 
Spelling Suggestions are offered only in the search results pages, after the user executes the search. 


Search Suggestion:-



There are four sources for spelling suggestions:

1. The default static spelling dictionaries (static out of the box dictionaries).

2. The default dynamic spelling dictionary (dynamically generated from your content). This     is also called a "content-aligned spelling dictionary".

3. The Query Spelling Inclusions term set (manually entered).
4. The Query Spelling Exclusions term set (manually entered).




Spelling suggestions are based on the closest matches in the default spelling dictionaries and the Query Spelling Inclusions list. 
Only one suggestion will be displayed. It appears that a phonic / sound alike match is being used, so the properly spelled and misspelled words must be similar in length and pattern.
You can’t edit the default static or dynamic spelling dictionaries.

Static dictionaries

The static dictionary is a canned list of words. (Something like the Word dictionaries.)

Dynamically created dictionaries

The dynamic dictionary is created by search as content is indexed. I.e. it's based on words commonly found in your content.

For dynamic spelling correction to work, you should have at least several thousand medium-sized documents. The default settings require that a word occur in at least 1000 documents to be included in the dictionary.

The dynamic dictionary is updated once a night and can be a long running process. (The default timeout is 6 hours!)

Query Spelling Inclusions / Exclusions

1. You must have a configured Managed Metadata Service.
2. The terms must be added to the auto-created Query Spelling Inclusions term set.
3. You manually enter a list of words into an include or exclude list of terms.
4. You can only include single words, not phrases in the term sets.


It may take ten minutes or more for updates to the term sets to show up in search results. (Search Custom Dictionaries Update timer job)

Using Power shell - Change the threshold limit for spelling suggestion (default is 1000 as stated above)


There are two PowerShell cmdlets that can be used to manage the on premises.

    Get-SPEnterpriseSearchQuerySpellingCorrection
    Set-SPEnterpriseSearchQuerySpellingCorrection

Note: These cmdlets are currently only for on premises SharePoint. It looks like Office 365 is set to use the Dynamic dictionary.
You can see the spelling suggestion options using:

    $ssa = Get-SPEnterpriseSearchServiceApplication
    Get-SPEnterpriseSearchQuerySpellingCorrection -SearchApplication $ssa
    


SpellingDictionary = Static / Dynamic

Many of the blogs state that you can choose either Static or Dynamic as the SpellingDictionary value, and that by selecting one of these you would exclude your manually entered Query Spelling Inclusions .

The confusion seems to be around the definitions of the words Static and Dynamic. 
My testing shows that:
  
Dynamic = use the list of words found in your content, plus the Query Spelling Inclusions term set

Static = use the static built-in / out of the box dictionary, plus the Query Spelling Inclusions term set

As an example, I do not have "SharePoint" or "SharePint" in my Query Spelling Inclusions term set, but I do have "corydoras". When I do a search for "SharePint" I get the following only when SpellingDictionary is set to Static: (this word is in the canned dictionary)
    
image

When searching for a term in the Query Spelling Inclusions term set like "corydoras"
 I get results regardless of if SpellingDictionary is set to Static or Dynamic.
    
image

Why don't I get any help when SpellingDictionary is set to Dynamic and I search for "SharePint"?
    
image

Take a look at the TermFrequencyThreshold property. Using the defaults SharePoint would need to find at least 1000 documents that contain the word "SharePoint". 

My testing sample set of documents is not quite that big. If I change it from 1000 to 20 and run the "Spelling dictionary update" timer job then I can start to get useful results from "Did you mean?" for "SharePint". (i.e. "SharePoint" was in at least 20 of my sample documents.)
    
image


Ref:  
https://technet.microsoft.com/en-in/library/jj219497.aspx
https://technet.microsoft.com/en-in/library/jj591607.aspx





Sorting does not Work in the Search Results Web Part in SharePoint 2013

That's very strange, defining the sorting criteria in the search result web part does not seems work. 
I had configured the search query in the Query Builder of the Search Web Part to retrieve the documents or Everything (which is very easy with the query builder). Underneath the sorting tab, I configured it to sort by the creation date.
Here you can see the sorting configuration:


ViewLifeTime Property :- Its give more hit item on the top, if we defined this property in descending order.

Solution Approach:-

Create one more result with replica of same (reason of replica - whatever we are going to define in that result source might not require in other place where we are going to use same result source)

Configuring the sorting in the web part settings did not work, so the next thing I tried was to create a result source with the same query. Creating a result source can be done on the Site Collection itself, so you do not need to go to Central Administration.
Step 1:
Go to Site Setting and select Manage result source under Site Collection Administration section. Click Edit.

 Step 2:
Select Launch Query Builder
Step 3:
Select sorting tab under Build your query section.
Select the sorting criteria whatever you want there and save  it.


After the creation of the result source and sort criteria just configured the search results query builder and specified my result source as the query that needs to be used.
This approach works perfectly, the result source does the sorting, instead of the search results web part.

Enable Sort Option in Search Result Page Share Point 2013

Adding the sort option on Search pages, It really comes like value addition to the search result. Everything or Document search have different option as OOTB where People search have different option as OOTB which will be depicts in below screen shots:-


1.Edit the Page 


2. Edit the search result web part

3. In the web part tool pane, scroll down and expand the Settings section. Click the Show sort drop down check box:


4.The sort options are controlled by the JSON in the Available sort orders text box. You may modify this to add or remove sort options. Feel free to choose from any of the 600+ managed properties available out-of-the-box. 

 Click OK in the toolpane and check-in the changes of the page.

Perform a search. A drop-down appears above the results


Similarly we can do with People Search also:-
You can follow same above step 1 and step 2

5. Select the check box i.e. show drop down  and JSON object will be different here.


6. Click OK in the toolpane and check-in the changes of the page.

   Perform a search. A drop-down appears above the results




Add Focus on the Search Box SharePoint 2013 Search

As a user navigates through your SharePoint Search Center, the page does not focus on any particular control or item on the page:



To enable this feature, edit a search results page that contains a search box. From the Search Box drop-down select Edit Web Part:

In the Search Box Web Part properties tool pane, scroll down and expand the Settings section. At the bottom of the section you'll see the option:

Simply check the checkbox and click OK. Check in and publish your results page. Now when the page is rendered, the focus is on the Search Box and the cursor appears accordingly.Sometimes the smallest things are the coolest! 

Remove Junk Data in SharePoint 2013 Search

How we can remove junk record from the search and how we can remove the content which never help in search results.

Search Result means - search result should give the result which actually meaningful and relevant not like links, folder etc. No one will be interested in going into folder and search the content  and AllItem.aspx page of List and Library - We can easily eradicate this type of junk records.


Below defined few area - we should always remember while setting up the search results:-
  1. Remove excess external content type links and nonsense
  2. Remove Folders from search results
  3. Remove overall list results (AllItems.aspx)
  4. Remove Link List Items
  5. Remove Link Lists
  6. Remove Explorer Views (web folder results)

User can navigate to any verticals or search navigation page and edit the same and modify the query of search result web parts, which  depicts in below images-






Remove the External Content Type:-


Remove the Folder from search:-


Remove overall List Results (AllItem.aspx)
Remove the Link List Items
Remove the Link Lists

Remove Explorer Views:

Final Query will be :-

At the end , we will more filter records which user want to see instead of junk data.


Download Microsoft SQL Server 2012 Management Studio

https://www.microsoft.com/betaexperience/pd/SQLEXPNOCTAV2/enus/default.aspx



Ref: https://thelonelydba.wordpress.com/2014/05/12/sql-server-2012-management-studio-download/

What is Federated Search SharePoint2013?

Usually we used the word Federated search – When we are going the content outside the SharePoint Environment and which is not crawl in our SharePoint Farm.
 For example, federation can provide search results from a web-search provider such as Bing, or perhaps from a private data set that you do not have access to crawl.
Another meaning of Federation:-
Federation can also be a good solution for a geographically distributed organization that wants to provide search access to content at its various locations when each location has its own search index. Because each location provides search results from its own index, it is not necessary to deploy a centralized search service that builds and accesses a single, unified index.

 In this context, federation can provide advantages such as the following:
  • Low bandwidth requirements ─ An organization that is geographically dispersed might not have the high network bandwidth that is required to crawl and index large amounts of remote content. When an organization uses federation, the main data that is transmitted for search across the wide-area network is only a set of search results from each federated content repository.
  • Freshness of search results ─ Each division within an organization can crawl the local content more quickly than a centralized search deployment would be able to crawl all of the content in the entire organization.
  • Divisional search variability ─ When an organization uses federation, each division within the organization can provide and control its own search environment. Each division can tailor search to its own requirements and preferences, with its own user experience and its own search connectors, for example. A centralized search portal would not allow for such differences.
  • Limited size of search indexes ─ A large, geographically distributed organization might have millions of documents. It might not be practical for the organization to have a single, unified search index because of the infrastructure that would be required to support such a large index. Federation enables users in each division to perform a single search to find relevant content that is distributed across multiple smaller search indexes in the organization.


Comparing Federated Search to Content Crawling in Enterprise Search

To help you decide whether to crawl a repository's content directly or by using federated search, you should consider the differences between the two approaches. You must determine which is most appropriate based on the content repository, and your requirements for the search results you want to return. There are advantages to both approaches.



Advantages of crawling content with SharePoint Enterprise Search
By querying the Search service application's content index for search results, you can do the following:
·         Sort results by relevance.
·         Control how frequently the content index is updated.
·         Specify what metadata is crawled.
·         Perform a single backup operation for crawled content.
Advantages of federating content with SharePoint Enterprise Search
By using federated search to return search results:
·         You require no additional capacity requirements for the content index, as content is not crawled by SharePoint Enterprise Search.
·         You can take advantage of a repository’s existing search engine. For example, you can federate to an Internet search engine to search the Web.
·         You can optimize the content repository's search engine for the repository's specific set of content, which might provide better search performance on the content set.
·         You can access repositories that are secured against crawls, but which can be accessed by search queries.


You select this protocol
To get federated search results from this kind of provider
Remote SharePoint
The index of a search service in another SharePoint farm
OpenSearch 1.0/1.1
An external search engine or feed that uses the OpenSearch protocol, such as Bing
Exchange
Exchange Server 2013



Code Sample to Federated Search SQL Server Connector

Added Federated Search (i.e. Bing Search in to SharePoint Search)