In SharePoint
2013 Enterprise search center preview searches nearly everything SharePoint
crawls. That’s why its search results are labelled “Everything”.
But for
specialized scenarios, you often want a specialized search experience to match.
Example:
People takes you to people search, returns only people results, responds
intelligently to certain people-related queries such as searches for a mail id,
phone no..
Build a
simple search experience for word, for that we have to create “Result Source”
and “Search Result Web Part”.
Search Experience = Result Source +
Search Results Web Part.
Create a word Result source
First, we have to create a Result Source
that only returns word results. From your enterprise search center, go to site
settings -> search -> Result Sources, Click on New Results
Click on New
Result source
It shows
window like this, we have to follow these steps.
· “Word” is
the source name.
· “Result with
file extension” is the description of source.
· Keep the
protocol on “Local SharePoint”, because we want item crawled by SharePoint.
· Keep the
type on “SharePoint Search Results”, we don’t want people results.
· Query
Transform: “{searchTearms} fileextension:pdf”.
,
Click “OK”,
we have created our “Word result source”
Create a Search Results Web Part
Go to search center, click the gear icon,
choose New Page (or) Go to site contents-> pages in ribbon add page give it
a name "Word".
Click
create, we create word page. Word is the Search Result Web Part. Default it
sends user queries to the local SharePoint Results source. We need to change it
so that it sends quires to our word Results source instead.
Open word page and in gear icon choose “Edit
page”, in search result heading next, click the little arrow next to the
checkbox that appears select edit web part.
It brings
Web Part tool pane. We want to change the query that this web Part sends, so
click to change Query button.
We only need a very simple transformation: the
Web Part should transform queries so that they go to a different Result Source.
So pick word Results from the Result Source drop down
Click "OK" on the Query Builder, then "OK" on the Web Part’s
tool pane, and finally publish your changes to the page.
Fleshing Out Your Search Experience
Now
add our "Word" Search to the Search Navigation, next to People, Conversations,
and the other standard search experiences.
Go
to Site Settings -> Search -> Search Settings.
Now
we configure Search Navigation links. Click on "Add Link"
We have to give title “Word”, then click Browse and pick the search page
we created earlier(Word page).
.
Click “OK”
to save link, select it and click “Move Up”.
Finally Click “Ok”, try to search in search center. You’ll see a link to your Word search, and clicking it will search
just docx files.