SharePoint 2013 Search with Refiner Webpart Out of memory error Issue

I have been waiting for an answer for the following issue. I felt it’s a MS bug since I can reproduce this in the OOB SharePoint 2013 page without any customization. Before I conclude this as bug I wanted to confirm with Microsoft.

Finally I came to know from a Microsoft field engineer that it’s a MS bug which they are going  to fix in the April 2014 CU.

To Reproduce please follow the below steps:

  • Create new site collection
  • Create new a Page
  • Add search results &  search refiner WebParts in the new page created
  • Search for something
  • Click on any refiner column and filter the result
  • Click browser back button. You will find the following message.


FYI: The same page will work without any error if you remove the refinement panel WebPart from the page.

So let us wait for the April 2014 CU.


SharePoint Search Suggestions

Where the Search Suggestions are saved in SharePoint?

When we start typing the keywords in the SharePoint search box control it internally performs an AJAX call to
/_vti_bin/client.svc/ProcessQuery and that calls the stored procedure proc_MSS_GetQuerySuggestions.
The proc_MSS_GetQuerySuggestions stored procedure gets the suggestions from the MSSQLogSearchCounts table.
This table exist in the <Search Service Application Name>__DB_<GUID> Database.

How Suggestions are saved?

  1. Manual ( using code / PowerShell / csv file import from central admin)
  2. Automatically by prepare query suggestions timer job.

What determines a query suggestion?

  • Query suggestions are based on frequently used search terms and click through to results. Listed below are the steps needed for SharePoint to promote a term to a query suggestion.
  • The associated Search Service application must have query logging enabled.
  • The user must type in a valid word or set of words in the search box.
  • The user must click on 6 or more search result links and open or save the file. Some types of pages containing the term can qualify as click-throughs.
  • The Query Logging timer job must be run.
  • The Prepare Query Suggestions time job must be run.

Some Powershell Operations related to Search Suggestion

#Add Single Suggestion

Add-PSSnapin “Microsoft.SharePoint.Powershell” -ErrorAction SilentlyContinue
$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App 2”
$owner = Get-SPEnterpriseSearchOwner -Level SSA
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $searchapp -Owner $owner
New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest -Name
“Honda” -Owner $owner
Start-SPTimerJob -Identity “prepare query suggestions”

#Add More than one Suggestion

Add-PSSnapin “Microsoft.SharePoint.Powershell” -ErrorAction SilentlyContinue
$SearchSuggestionsList = @(“Car”, “Honda”, “F1”)
$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App 2”
$owner = Get-SPEnterpriseSearchOwner -Level SSA
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $searchapp -Owner $owner

foreach ($Suggestion in $SearchSuggestionsList)
New-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest –
Name $Suggestion -Owner $owner

Start-SPTimerJob -Identity “prepare query suggestions”

#Get All Search Suggestions

Add-PSSnapin “Microsoft.SharePoint.Powershell” -ErrorAction SilentlyContinue

$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App 2”
$owner = Get-SPEnterpriseSearchOwner -Level SSA
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $searchapp -Owner $owner

#Remove Single Search Suggestion

Add-PSSnapin “Microsoft.SharePoint.Powershell” -ErrorAction SilentlyContinue

$searchapp = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service App 2”
$owner = Get-SPEnterpriseSearchOwner -Level SSA
Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $searchapp -Owner $owner

Remove-SPEnterpriseSearchLanguageResourcePhrase -SearchApplication $searchapp -Language En-Us -Type QuerySuggestionAlwaysSuggest –
Identity “Honda” -Owner $owner

Start-SPTimerJob -Identity “prepare query suggestions”

Suggestions Table

SAP Integration with .NET Based Application

Last weekend I had a conversation with my uncle (Chief Development Architect at SAP Labs – India) regarding the SAP integration with .NET based application. It was a useful conversation and I got some very good information which I would like to share with you.

Question 1: 

I have a SAP integration requirement. Could you please suggest if below are good for connecting SAP from .NET without using .NET connector

1)      Expose RFC as web services

  • Is it a good approach?
  • Any Disadvantages/issues?

2)      Using Enterprise services explorer?

  • The latest version I see is ES explorer 1.1 which supports VS 2008.Do we have any latest version and if yes what version of VS does it support?
  • Is this a good approach?


Today, the preferred integration approach is to use OData that is agnostic of the consumer (i.e.) consumer can be ABAP, Java, .Net etc…

For this, you would need a SAP NW Gateway Server.

More details on Gateway can be found here:

Question 2: 

We already have SAP Business Suite (SAP ECC 6.0). I read that if we are a customer of SAP, the NetWeaver gateway is a free download. Do we still need to have a new server for this?


There are 2 possible deployment options (hub – you need a new server / embedded – you can install on the same ECC)


Which is best Workflows OR Event Receivers?

Which is best Workflows OR Event Receivers?

Deciding Factors  


Event Receiver

Do you have Wait for an Item Update / Wait Until requirements (basically related to time)?



Interaction with Users such as Assign Task, Delegation, Request Data



Do you have High Volume of Transactions?



Do you have any browser / client specific change requirements (using SharePoint Designer / Visio / Nintex)?



Do need manual Trigger?



Do you wish to execute post or prior the events?



Do you wish to trigger an event with Service Account token on item created / modified?



Priority in executing some action (Workflow will run first)



Do you wish to migrate the running instances from one environment to other environment easily :)?



Configure item level security in SharePoint BCS

In SharePoint 2007 version we can only apply the query time security trimming on BDC Entities, Where in SP 2010 / 2013 you can implement the security trimming in the Crawl time also.

If you wish to trim your SharePoint search results on external system using BCS based on your own logic, there are two approaches:

  • CRAWL time security trimming
  • QUERY time security trimming

Applying security trimming logic at query level needs to be checked against every item returned from the search query for current user. It’s a very heavy process. When we use NTLM users to apply permission for the individual items in the external system then it’s better to go with CRAWL time security trimming.  In the crawl time security trimming approach, you just need an additional column in the external system table which will be used to save the permission details for each item. This will work if you are building a new BCS Model from the scratch. It’s very difficult to apply crawl time security trimming logic in an ongoing complex BCS application. So in that case you can better use query time security trimming approach.

Please refer this article –

Simple Watermark function for HTML Inputbox

One of the simplest way to create Watermark functionality for the HTML Input control 

value=”Search Wiki”
onblur=”if(value==”) value = ‘Search Wiki'”
onfocus=”if(value==’Search Wiki’) value = ””

Display semicolon separated values in ASP.NET Label as new lines


As a part of your daily coding life at times you may have to split the input value with a value and show in newline as a read only value using a Label control.

If you come across this requirement, you can use the below code snippet. In this example I am splitting the input string with semicolon.

If your input value has any html inputs then you have to use Server.HtmlEncode when you bind the data as a new line.

Front End Code

<asp:Label ID=”lbl_PreviousApprover” runat=”server”>

<asp:Repeater ID=”rep_PreviousApprover” runat=”server”>


<%# Server.HtmlEncode( (string) (Container.DataItem) ) %><br />




Backend Code

List<string> list_PreviousApprover = new List<string>(((string.IsNullOrEmpty(str_Input) ? string.empty : str_Input).Split(new string[] { “;” }, StringSplitOptions.None)));

if (list_PreviousApprover.Count > 0)


for (int list_PreviousApprover_index = 0; list_PreviousApprover_index < list_PreviousApprover.Count; list_PreviousApprover_index++)


bool nullOrEmpty = string.IsNullOrEmpty(list_PreviousApprover[list_PreviousApprover_index].Trim());

if (nullOrEmpty)






rep_PreviousApprover.DataSource = list_PreviousApprover;





lbl_PreviousApprover.Text = “-“;