Thursday 25 September 2014

SharePoint Search box read input search key word

You can find using below code...
var keyword=ctx.CurrentItem.HitHighlightedSummary;
Steps:
Open Search result webpart Item Template(Edit Search result webpart-->Expand Display Templates
-->Under "Use a single template to display items"
Check what is the name of Item Template. Ex: SearchResult_item
Now go to Site Settings-->Master pages and page layouts -->Display Templates-->Search
Now find the Item Template which you find in the earlier steps. Ex: SearchResult_item
Download that. Open in notepad or Visual Studio
Find below code....
var keyword=ctx.CurrentItem.HitHighlightedSummary;