Skip to main content

Posts

SharePoint 2013 CTX variable and its function part 1

In this post going to show you some of the useful Utility Functions that might be useful for you while working with search display template. I used most of the functions MSDN Link: https://msdn.microsoft.com/EN-US/library/office/dn768285.aspx CTX Function Part 2   CTX Function Part 3 CTX: In Display template CTX variable is responsible for returning the all the managed properties and other DOM elements. Utility Functions String Functions: For checking Null, Undefined & empty values  Srch.U.w(str): Indicates whether the given string is null, undefined, or empty. $isNull(str): Checking for Null Srch.U.n(str): Indicates whether the given object is null or undefined. $isEmptyString(str) : Checking for an empty string Srch.U.e(str): Indicates whether the string is null or empty. Array Functions: Split & other array related operations Srch.U.getArray(property): Splits the string into an array of strings using the semi colon (";") as a s...

Query suggestions in SP 2013 Using Rest API (/_api/search/suggest)

SharePoint Query suggestions: In this post I am going to share with you code snippets to implement the query suggestion in custom text box. Below are the dependency files  1. Jquery UI : http://code.jquery.com/ui/1.10.0/jquery-ui.js 2. Jquery AutoComplete CSS: http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css http://code.jquery.com/ui/1.10.0/themes/base/jquery.ui.autocomplete.css 3. JQuery: http://code.jquery.com/jquery-1.8.3.js Query Suggestion Parameter: Here is the post http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx that specified the detail query suggestions parameter list. Implementation: I have two vertical examples. 1. People Vertical 2. Everything Vertical I wanted to display the query suggestions on TeamSite pages although my search is configured in one of our serach center, so when user search for a particular term and it contains in the search query completion li...

SharePoint 2013 Pagination Options Google/Bing/etc

Google, Bing pagination on SharePoint search result page only two step away.  OOB Pagination Control options  Start Position When user click to the “2” page to the previous and next button will appear The total number of page will display on pagination control at a time is 6. So the page number 1 is not visible 1) Export Search Results Web Part: Number of pages in pagination UI is controlled by two variables in the Search Results web part: <property name="MaxPagesBeforeCurrent" type="int">7</property> <property name="MaxPagesAfterCurrent" type="int">7</property> You will now get this: To get the UI to always go back to Page 1: 2) Source code added to Search Display Template Control_SearchResults.html starting on about line 399. <!--#_ //max before current page - ctx.ClientControl.$1K_4 //current page - ctx.ClientControl.$14_4 // if page 1 no longer shows in the pagination ...

Migration Content DB 2010 to 2013 contextual Search issue

I found one most interesting issue while site collection migrated to 2010 to 2013. We have migrate SharePoint content DB 2010 to 2013 and found that the contextual search retuning the whole data for each search term no refiner working no “hit highlighting” but the result returned by the search service somehow. Every search term the service returned the same results. I have checked the same result in our search center as well in other site collection even checked contextual search all working fine as expected. So  only issue in the migrated site collection. I have mentioned the same issue on  MSND Question . To deep dive need to enable the VerboseEx log in the search farm and check what’s going behind the screen.I used the following command LETS (PowerShell) to enable the VerboseEx log. get-sploglevel | where {$_.Name -eq "Query"} | Set-SPLogLevel -TraceSeverity VerboseEx get-sploglevel | where {($_.Area -like "Search") -And ( ($_.Name -eq "Query Proc...

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 ...

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 templ...

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

The SharePoint 2013 recommendation analytic engine allows the end users to provide the most access content through the “specific keyword” and clicked the specific result more than 10 times; it will be displayed above the search result and bottom of the query suggestion (search box). What I will cover in this post. Why we need to remove the “you have seen this before results” (specific issue)? How to reproduce the “You have seen this before” results? How to find the “You have seen this before” template & which results set returns responsible for render the results for this type? How I remove the “You have seen this before Results”? Better Solution: How rewrite the   “You have seen this before results” URL with your own custom property? Why we need to remove “you have seen this before results” (specific issue)? When we are doing some customizations in the result template to display the custom URL other the actual URL then we would required to remove / or u...