SharePoint 2013: Remove from the search result "You have seen this before" Recommendation Part 3
I am continuing with my third part with the same “You have seen this before” series. I must recommended please have a look on my post 1 and post 2.
Better Solution: How rewrite the “You have seen this before results” URL with your own custom property?
This solution is not full proof solution, it has two parts, one part is almost done next part I am working on it.
- Modify the Search results (Recommend you to take the backup of template and set the same to for search box control correct “Control_SearchBox.html”)
- Modify the Search box template (Recommend you to take the backup of your template and apply this solution in your box “Control_SearchResults.html”).
As we are already know that the default template not having all the properties available
Follow the step to implement the rewrite the URL template.
- Fist take the copy template depending upon the result type that you going to rewrite example (if you are your result appear in the list item to take the copy of item_default.html , if word the take the copy of item_word.html)
- Once you take the copy of the template give it a unique file name also set its title by edit the template html and its title. The same value available in the result type in the Drop Down as well.
- So edit the template in step 2, provide your custom properties in at the title between the tags “<mso:ManagedPropertyMapping>” once it done. I have included the "CustomURL" and same property, I used in the step 8.
- Save the template and create new result type and provide select the template created in step 2.
- You may get the sync properties message click update to sync the properties. Once you done.
- Next step you need to work on the control_searchresult.html file
- Edit the file and “Post1” I have mentioned the “personalFavoriteResults” responsible for render the “You have seen this before” results.
- I have written custom code that will get the same result from “RelevantResults” result table and match for the URL with “personalFavoriteResults” URL, once it matched its update the URL value from custom property.
Download the template: control_searchresult.html
By downloading the applied the above template I am able to fix the URL issue but the issue still pending in case of "Search box" query suggestion the URL still there. I am working on it and update on this post once i will get the solution.