Skip to main content

SharePoint 2013: Remove from the search result "You have seen this before" Recommendation Part 2

This post continue form my last post,  as I described the issue “you have seen this before” in my last post so here I am continue with its second part. So let’s begin with it so I am going to the answer of the question, I mentioned in the last post.

How I remove the “You have seen this before”?

To remove the “You have seen this before template” as mentioned above it is very simple before going to this as per the good practice. It is not a good idea to remove “you have seen this before” from all form the search results it would better to remove only for those results causing an issue (rewrite URL(s) or custom URL as mentioned in the above mentioned)

To remove “you have seen this before” items from all the results. (Not recommended Solution) 
Edit the common template “Item_CommonItem_Body.html”, as we know this template is used to display the common properties like title, URL and hithighlighted. Search for “clickType” item inside the template, you will find the following items.
var clickType = ctx.CurrentItem.csr_ClickType;
if(!clickType) {clickType = "Result"}
var titleHtml = String.format('<a clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>', $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));

Remove the clicktype="{0}" from the link this will send the information to the analytic engine to 
calculate the click. So remove  clicktype="{0}" form the  titleHtml variable and the updated link 

Item would be like as mentioned below.
var titleHtml = String.format('<a id="{0}" href="{1}" class="ms-srch-item-link" title="{2}" onfocus="{3}" {4}>{5}</a>',  $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title),   showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));

To remove “you have seen this before” items from specific the results. (Better Way to remove the selected one, depending upon the query type condition)


To remove the “you have seen this before” from the specific type of record, for that you need to identify the template which responsible for display the data?


Once you identify the content, next step make the copy of this template and give it new name in the title and the template give a new name. So next step remove the _#=ctx.RenderBody(ctx)=#_ form the body & copy the content of the <div id="Item_CommonItem_Body"> with div and paste in place of this content.



Let start with an example
  • Copy the template “item_word.html” and give it name like “custom item template” and changed the copied template with “sharepointfordeveloper_item_word.html” name.
  • Open “sharepointfordeveloper_item_word.html” template and replace the _#=ctx.RenderBody(ctx)=#_   tag with <div id="Item_CommonItem_Body"> tag and content with  “Item_CommonItem_Body.html” template.
  • Remove the clicktype="{0}" from the link this will send the information to the analytic engine to calculate the click. So remove clicktype="{0}" form the  titleHtml variable and the updated link item would be like as mentioned below. 
var titleHtml = String.format('<a id="{0}" href="{1}" class="ms-srch-item-link" title="{2}" onfocus="{3}" {4}>{5}</a>',  $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title),   showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));
  • Save the template and published in the display template gallery.
  • Create the new result type and apply the condition that specify the condition which includes the customize URL rewrite implemented.
Part 2: SharePoint 2013: Remove from the search result "You have seen this before" Recommendation Part 3 

Comments

Popular posts from this blog

SharePoint RPC Protocols Examples Using OWSSVR.DLL

What is SharePoint RPC Protocols? Part 1 This reference includes information about the methods and usage of SharePoint Foundation Remote Procedure Call (RPC) protocol. This protocol can be used in Win32-based applications or in ASPX applications to make HTTP POST requests to the server. Methods in this protocol that do not modify the contents of the database can also be used in URL protocol to make HTTP GET requests. Definition taken from http://msdn.microsoft.com/en-us/library/ms448359.aspx You will find the OWSSVR.DLL in SharePoint 2010 Server Physical Path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI and MOSS C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI OWSSVR.DLL List of commands DialogView  Display ExportList GetProjSchema GetUsageBlob HitCounter RenderView To read more about the OWSSVR.DLL command Please read the URL Protocol from Microsoft Blog having a URL http://msdn.microsoft.com/en...

SharePoint 2013 Search Database Part 1

SharePoint 2013 Search architecture drastically change, as earlier in FS4SP 2010 we have 2 search applications “FASTContentSSA” and “FASTQuerySSA” and 7 total database in use. Following are the List of DB (FS4SP) FASTContentSSA Search Service Application DB Search Service Application Crawl Store DB Search Service Application Property Store DB FASTQuerySSA Search Service Application DB Search Service Application Crawl Store DB Search Service Application Property Store DB FASTSearchAdminDatabase : Fast Search Admin Database  In SharePoint 2013 search has only 1 Search Service application and 4 database in use. No property store database need any more, now the properties are directly stored inside the index component and all the index directly indexed to the physical system where FS4SP data comes from database as well as from the File system now data directly stored and indexed/ retried from the Physical disk because of this performance increase and search experien...

STS CryptographicException Error : Key set does not exist

Common mistakes Both SharePoint Site and SSO Site NOT running on the same application pool. Application pool identity user doesn’t have permission to access the certification.  Solution to this problem Set the same identity pool to  : 2. Be sure to grant rights to the certificate for the App Pool running the web service Start -> Run -> MMC File -> Add/Remove Snapin Add the Certificates Snap In Select Computer Account, then hit next Select Local Computer (the default), then click Finish On the left panel from Console Root, navigate to Certificates (Local Computer) -> Personal -> Certificates You're certificate will most likely be here. Right click on your certificate -> All Tasks -> Manage Private Keys Set you're private key settings here. Add app pool account Reset iis