<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Search Archives : Binary Bits</title>
	<atom:link href="https://blog.binarybits.net/tag/search/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.binarybits.net/tag/search/</link>
	<description>Bits &#38; Pieces - A blog by Kannan Balasubramanian</description>
	<lastBuildDate>Mon, 03 May 2021 10:50:10 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Add count to drop down refiners in SharePoint search refinement webpart</title>
		<link>https://blog.binarybits.net/add-count-to-drop-down-refiners-in-sharepoint-search-refinement-webpart/</link>
					<comments>https://blog.binarybits.net/add-count-to-drop-down-refiners-in-sharepoint-search-refinement-webpart/#respond</comments>
		
		<dc:creator><![CDATA[Kannan]]></dc:creator>
		<pubDate>Thu, 10 Mar 2016 11:43:06 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Refiners]]></category>
		<category><![CDATA[Search]]></category>
		<guid isPermaLink="false">https://blog.binarybits.net/?p=747</guid>

					<description><![CDATA[<p>While working on designing display template for drop down based refiners in SharePoint Search there was a requirement to show counts along with refiners in refiners list. Following is the change which I made in the refiner&#8217;s display template. Actual code &#60;option value='_#= onChangeOrClick =#_'&#62;_#= $htmlEncode(refinementName) =#_&#60;/option&#62;  Updated Code &#60;option value='_#= onChangeOrClick =#_'&#62;_#= $htmlEncode(refinementName) =#_ [&#8230;]</p>
<p>The post <a href="https://blog.binarybits.net/add-count-to-drop-down-refiners-in-sharepoint-search-refinement-webpart/">Add count to drop down refiners in SharePoint search refinement webpart</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>While working on designing display template for drop down based refiners in SharePoint Search there was a requirement to show counts along with refiners in refiners list.</p>
<p>Following is the change which I made in the refiner&#8217;s display template.</p>
<p><strong>Actual code</strong></p>
<pre class="lang:xhtml decode:true ">&lt;option value='_#= onChangeOrClick =#_'&gt;_#= $htmlEncode(refinementName) =#_&lt;/option&gt;</pre>
<p><strong> Updated Code</strong></p>
<pre class="lang:xhtml decode:true  ">&lt;option value='_#= onChangeOrClick =#_'&gt;_#= $htmlEncode(refinementName)  =#_  (_#= refinementCount =#_)&lt;/option&gt;</pre>
<p>The post <a href="https://blog.binarybits.net/add-count-to-drop-down-refiners-in-sharepoint-search-refinement-webpart/">Add count to drop down refiners in SharePoint search refinement webpart</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.binarybits.net/add-count-to-drop-down-refiners-in-sharepoint-search-refinement-webpart/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hide Available Refiners in SharePoint search refinement panel</title>
		<link>https://blog.binarybits.net/hide-available-refiners-in-sharepoint-search-refinement-panel/</link>
					<comments>https://blog.binarybits.net/hide-available-refiners-in-sharepoint-search-refinement-panel/#respond</comments>
		
		<dc:creator><![CDATA[Kannan]]></dc:creator>
		<pubDate>Tue, 08 Mar 2016 10:37:02 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Refiners]]></category>
		<category><![CDATA[Search]]></category>
		<guid isPermaLink="false">https://blog.binarybits.net/?p=737</guid>

					<description><![CDATA[<p>Recently one of the customer had a strange request where the customer wanted to Hide &#8220;Available Refiners&#8221; in SharePoint search refinement panel. The &#8220;Available Refiners&#8221; is available in &#8220;Drop Down&#8221; type refinement panel. When the refinement panel is being loaded, SharePoint executes a JavaScript function named AddPostRenderCallback. This would be available in the Refinement Display [&#8230;]</p>
<p>The post <a href="https://blog.binarybits.net/hide-available-refiners-in-sharepoint-search-refinement-panel/">Hide Available Refiners in SharePoint search refinement panel</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Recently one of the customer had a strange request where the customer wanted to Hide &#8220;Available Refiners&#8221; in SharePoint search refinement panel.</p>
<p>The &#8220;Available Refiners&#8221; is available in &#8220;Drop Down&#8221; type refinement panel.</p>
<p><a href="https://blog.binarybits.net/wp-content/uploads/2016/03/sharepoint-refinement-panel.png" target="_blank"><img decoding="async" class="alignnone wp-image-738 size-full" src="https://blog.binarybits.net/wp-content/uploads/2016/03/sharepoint-refinement-panel.png" alt="SharePoint Refinement Panel" width="235" height="140" /></a></p>
<p>When the refinement panel is being loaded, SharePoint executes a JavaScript function named <em>AddPostRenderCallback</em>. This would be available in the Refinement Display Template located under MasterPage/Search Gallery. The actual method looks like below code which is taken from O365.</p>
<pre class="lang:js decode:true" title="Add Post Rende rCallback">AddPostRenderCallback(ctx, function() {
    if (hasAnyFiltertokens) {
        // Get the hidden block
        var hiddenOptions = document.getElementById(hiddenBlockID).children;
        var unSelGroup = document.getElementById(unselDD);
        var selGroup = document.getElementById(selDD);
        // Clone all the elements from the hidden list to the unselected option group
        for (var i = 0; i &lt; hiddenOptions.length; i++) {
            var selectedElm = GetAllElementsWithAttribute(selGroup, 'value', hiddenOptions[i].getAttribute('value').replace('updateRefinersJSON', 'removeRefinementFiltersJSON'));
            if (selectedElm === null || selectedElm.length &lt;= 0) {
                var cloneElm = hiddenOptions[i].cloneNode(true);
                unSelGroup.appendChild(cloneElm);
            }
        }
    }
});</pre>
<p>To the above original code I made a small change so that &#8220;Clone all the elements&#8221; code executes only when user has selected a refiner.</p>
<pre class="lang:c# decode:true " title="Existing " clone="" all="" the="" elements="" code="">// Clone all the elements from the hidden list to the unselected option group
if(selectedFilters.length &lt;= 0)
{
	for (var i = 0; i &lt; hiddenOptions.length; i++) {
		var selectedElm = GetAllElementsWithAttribute(selGroup, 'value', hiddenOptions[i].getAttribute('value').replace('updateRefinersJSON', 'removeRefinementFiltersJSON'));
		if (selectedElm === null || selectedElm.length &lt;= 0) {
			var cloneElm = hiddenOptions[i].cloneNode(true);
			unSelGroup.appendChild(cloneElm);
		}
	}
}
</pre>
<p>To the above orignal code I added the following code to hide the &#8220;Available Refiners&#8221; option.</p>
<pre class="lang:c# decode:true" title="Hide Available Refiners">if(selectedFilters.length &gt; 0)
{
	if(unSelGroup!=null)
	{
		unSelGroup.style.display = 'none';
	}
}</pre>
<p>The above code will hide the &#8220;unSelGroup&#8221;&#8216;s &#8220;Option Group&#8221; HTML to hide the Options for &#8220;Available Refiners&#8221;.</p>
<p>Final code would look like below.</p>
<pre class="lang:c# decode:true " title="Hide Available Refiners in AddPostRenderCallback">AddPostRenderCallback(ctx, function() {
    if (hasAnyFiltertokens) {
        // Get the hidden block
        var hiddenOptions = document.getElementById(hiddenBlockID).children;
        var unSelGroup = document.getElementById(unselDD);
        var selGroup = document.getElementById(selDD);
        // Clone all the elements from the hidden list to the unselected option group
        if(selectedFilters.length &lt;= 0)
        {
            for (var i = 0; i &lt; hiddenOptions.length; i++) {
                var selectedElm = GetAllElementsWithAttribute(selGroup, 'value', hiddenOptions[i].getAttribute('value').replace('updateRefinersJSON', 'removeRefinementFiltersJSON'));
                if (selectedElm === null || selectedElm.length &lt;= 0) {
                    var cloneElm = hiddenOptions[i].cloneNode(true);
                    unSelGroup.appendChild(cloneElm);
                }
            }
        }
        //Added for Gold Asset requirement where once a refiner is selected the "Avaialble Refiners" item should be made hidden
        if(selectedFilters.length &gt; 0)
        {
            if(unSelGroup!=null)
            {
                unSelGroup.style.display = 'none';
            }
        }
        
        var refinerUpArrow = document.getElementById('refinerExpandCollapseArrow');
        if(refinerUpArrow!=null)
        {
            refinerUpArrow.style.display = 'none';
        }
        
    }
});

</pre>
<p>End Result is following<br />
<a href="https://blog.binarybits.net/wp-content/uploads/2016/03/sharepoint-hidden-available-refiners-option.png" target="_blank"><img decoding="async" class="alignnone wp-image-739 size-full" src="https://blog.binarybits.net/wp-content/uploads/2016/03/sharepoint-hidden-available-refiners-option.png" alt="Hidden Available Refiners Option Group" width="169" height="69" /></a></p>
<p>The post <a href="https://blog.binarybits.net/hide-available-refiners-in-sharepoint-search-refinement-panel/">Hide Available Refiners in SharePoint search refinement panel</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.binarybits.net/hide-available-refiners-in-sharepoint-search-refinement-panel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Clear SharePoint Search Results</title>
		<link>https://blog.binarybits.net/clear-sharepoint-search-results/</link>
					<comments>https://blog.binarybits.net/clear-sharepoint-search-results/#respond</comments>
		
		<dc:creator><![CDATA[Kannan]]></dc:creator>
		<pubDate>Mon, 07 Mar 2016 08:33:57 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Search]]></category>
		<guid isPermaLink="false">https://blog.binarybits.net/?p=734</guid>

					<description><![CDATA[<p>Recently I had a requirement for OOTB search Box + Result where the customer wanted to clear the search results regardless of any refinement selected or not. To implement this, in the display template HTML the following was added. Do note that if refinements are there, the commented single line of code didn&#8217;t work and [&#8230;]</p>
<p>The post <a href="https://blog.binarybits.net/clear-sharepoint-search-results/">Clear SharePoint Search Results</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Recently I had a requirement for OOTB search Box + Result where the customer wanted to clear the search results regardless of any refinement selected or not.</p>
<p><a href="https://blog.binarybits.net/wp-content/uploads/2016/03/clear-sharepoint-search-results.png" target="_blank" rel="noopener"><img decoding="async" class="alignnone wp-image-741 size-medium" src="https://blog.binarybits.net/wp-content/uploads/2016/03/clear-sharepoint-search-results-300x43.png" alt="Clear SharePoint Search Results" width="300" height="43" srcset="https://blog.binarybits.net/wp-content/uploads/2016/03/clear-sharepoint-search-results-300x43.png 300w, https://blog.binarybits.net/wp-content/uploads/2016/03/clear-sharepoint-search-results.png 565w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>To implement this, in the display template HTML the following was added.</p>
<p>Do note that if refinements are there, the commented single line of code didn&#8217;t work and I had to replace the entire # as blank. Do check the original source (mentioned below) for more information.</p>
<pre class="lang:xhtml decode:true" title="Clear SharePoint Search Result">&lt;!--#_
    clearSearchResults = function()
    {
        var hash = window.location.hash;
        if( hash.indexOf('Default') == 1 ) {
            hash = unescape(hash);
            var kIdx = hash.indexOf('"k":'); 
            var rIdx = hash.indexOf('","'); 
            var query = hash.substring(kIdx+5,rIdx);
            query = query.replace(/\\/g, '');
            //window.location.href = window.location.pathname + window.location.search + '#k=' + escape(query);
            window.location.href = window.location.pathname + window.location.search + '#';
        } else {
            window.location.href = window.location.pathname + window.location.search + "#";
        }                    
    }
_#--&gt;
&lt;div id="ClearSearch" class="ms-alignCenter"&gt;
    &lt;h2&gt;&lt;a onclick="clearSearchResults();"  style="cursor:pointer"&gt;Clear/Reset All&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;</pre>
<p>The source for the above code is <a href="http://www.techmikael.com/2013/06/add-clear-filters-link-to-your-search.html" target="_blank" rel="noopener">Add a “Clear Filters” link to your search page in SharePoint 2013</a></p>
<p>The post <a href="https://blog.binarybits.net/clear-sharepoint-search-results/">Clear SharePoint Search Results</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.binarybits.net/clear-sharepoint-search-results/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Searching in a list with one keyword across two columns</title>
		<link>https://blog.binarybits.net/searching-in-a-list-with-one-keyword-across-two-columns/</link>
					<comments>https://blog.binarybits.net/searching-in-a-list-with-one-keyword-across-two-columns/#respond</comments>
		
		<dc:creator><![CDATA[Kannan]]></dc:creator>
		<pubDate>Mon, 01 Apr 2013 11:10:36 +0000</pubDate>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[multiple columns]]></category>
		<category><![CDATA[Search]]></category>
		<guid isPermaLink="false">https://blog.binarybits.net/?p=499</guid>

					<description><![CDATA[<p>We have a document list with 2 columns. One is a text column and other is a lookup column The requirement was that, user should be able to search across two columns, where the condition being, search should match with either of the column. The following url format works for this particualr scenario. http://server/sites/site1/sitePages/DocumentSearchPage.aspx?k= &#38;r=Column1:&#8221;query*&#8221; [&#8230;]</p>
<p>The post <a href="https://blog.binarybits.net/searching-in-a-list-with-one-keyword-across-two-columns/">Searching in a list with one keyword across two columns</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We have a document list with 2 columns. One is a text column and other is a lookup column</p>
<p>The requirement was that, user should be able to search across two columns, where the condition being, search should match with either of the column. The following url format works for this particualr scenario.</p>
<blockquote><p>http://server/sites/site1/sitePages/DocumentSearchPage.aspx?k= &amp;r=Column1:&#8221;query*&#8221; OR Column2:&#8221;query*&#8221;&amp;cs=This List&amp;u=http://server/sites/site1/library1</p></blockquote>
<p>Note:</p>
<p><em>DocumentSearchPage.aspx</em> has a <em>Search Core Results</em> webpart.</p>
<p>The parameer &#8220;k&#8221; is not required. But sometime without this parameter search result is blank. Hence &#8220;k&#8221; will have a empty character as string.</p>
<p><em>cs=This List</em> is a query paramter which helps in searching a particular library. This depends on the parameter &#8220;u&#8221; explained in next line.</p>
<p><em>u=http://server/sites/site1/library1</em> is the library from which search result should come.</p>
<p>The post <a href="https://blog.binarybits.net/searching-in-a-list-with-one-keyword-across-two-columns/">Searching in a list with one keyword across two columns</a> appeared first on <a href="https://blog.binarybits.net">Binary Bits</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.binarybits.net/searching-in-a-list-with-one-keyword-across-two-columns/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: blog.binarybits.net @ 2026-05-28 21:02:20 by W3 Total Cache
-->