SharePoint 2013: Programmatically set crawl cookies for forms authenticated web sites


August 29, 2015 - 07:54, by Steven Van de Craen - 0 Comments

Last week I was having difficulties in crawling forms authenticated web sites. When configuring a crawl rule to store the authentication cookies the login page was returning multiple cookies with same name but different domain.

Add Crawl Rule

This gave issues in a later stage (during crawl) because all cookies would be sent along with the request, the target system had issues correctly identifying us due to these “duplicate” cookies.

You can easily check the request information that is sent during crawl by starting fiddler on the crawl server and configuring the proxy settings to http://localhost:8888 (default Fiddler settings).

 Search Proxy Setting

In the end we chose for an alternate method of configuring the cookies, namely through PowerShell. This gave us the ultimate flexibility to configure exactly the cookies we wanted to pass along with the crawl requests.

asnp microsoft.sharepoint.powershell -ea 0 | Out-Null $ssa = get-spenterprisesearchserviceapplication $crPath = 'http://authenticatedwebsite*' # Get or create crawl rule $cr = Get-SPEnterpriseSearchCrawlRule -SearchApplication $ssa | ? { $_.Path -eq $crPath } if ($cr -eq $null) { $cr = New-SPEnterpriseSearchCrawlRule -Path $crPath -SearchApplication $ssa -Type InclusionRule -AuthenticationType CookieRuleAccess -FollowComplexUrls $true } # Set cookie credentials $cr.SetCredentials('CookieRuleAccess', 'myUser=crawlUser; myPwd=crawlPassword', 'http://cookie-set-via-powershell')

HTH


SharePoint 2013: Some observations on Enterprise Search


August 13, 2015 - 16:44, by Steven Van de Craen - 0 Comments

I’m doing some testing with the Enterprise Search in SharePoint 2013 for a customer scenario and here are some observations…

Content Source as Crawled Property

The “Content Source” name is out of the box available as Managed Property on all content in the search index

This makes it possible to create Result Sources that aggregate content from different Content Sources similar to Search Scopes back in the old days.

SharePoint 2013 Search Query Tool #1

Meta elements (HTML <meta> tags) as Crawled Properties

Information from meta elements in web pages is extracted into crawled properties

Consider the following example:

Simple website with meta tags

After crawling this website with SharePoint 2013 Search it will create (if new) or use (if existing) a Crawled Property and store the content from the meta element. The Crawled Property can then be mapped to Managed Properties to return, filter or sort query results.

SharePoint 2013 Search Query Tool #2

Query string parameters as Crawled Properties

Query string parameters are not extracted into Crawled Properties

This was actually a request from the customer in order to be able to provide additional information regarding documents (on their website) into the search index. As I suspected it isn’t possible out of the box but you could definitely do it using Content Enrichment.

The “OriginalPath” is available as an input property for Content Enrichment and contains the exact url used for indexing the document:

Content Enrichment Input Properties

With Content Enrichment it is pretty straightforward to look for predefined query string parameters and then map them to output properties.

$ssa = Get-SPEnterpriseSearchServiceApplication $config = New-SPEnterpriseSearchContentEnrichmentConfiguration $config.Endpoint = 'http://cews:818/ContentEnrichmentService2.svc' $config.InputProperties = 'OriginalPath', 'ContentSource' $config.OutputProperties = 'MyParam1', 'MyParam2' $config.DebugMode = $false $config.SendRawData = $false Set-SPEnterpriseSearchContentEnrichmentConfiguration –SearchApplication $ssa –ContentEnrichmentConfiguration $config

More information on Content Enrichment from my SharePoint Saturday presentation: http://www.sharepointblogs.be/blogs/vandest/archive/2014/04/28/sharepoint-saturday-belgium-2014-content-enrichment-in-sharepoint-search.aspx

HTH


SharePoint Saturday Belgium 2014 - Content Enrichment in SharePoint Search


April 28, 2014 - 15:06, by Steven Van de Craen - 0 Comments

Last Saturday I delivered a session on “Content Enrichment in SharePoint Search” on the Belgian SharePoint Saturday 2014, showing how to configure it, its potential and some development tips and tricks. Although it was a very specific and narrow topic there was a big audience for it. We even had to bring in extra chairs to have everyone seated.

If you missed my session (shame on you!) or you want to read up on it again, below is my deck and demo code.

Slides

SPSBE 2014 Content Enrichment in SharePoint Search

 

Code

The demos showed the basic configuration, how to use WCF Routing to overcome the biggest limitation, how to debug using Fiddler by configuring the proxy, how to debug by attaching to the noderunner process, etc. The final demo would extract bank account numbers from indexed documents and store them in dedicated Managed Properties to increase findability when searching on one of these numbers.

» SPSBE2014.ContentEnrichmentInSearch.zip

Disclaimer: you’re free to use this code as you desire, but I’m not taking responsibility should it blow up your server or make babies cry.

 

Community Red heart

I think we can all agree that SPSBE2014 was a huge success. A big applause for the organisers, the speakers and the attendees for making it all happen. It goes to show that the our SharePoint Community is really great, so show them some love on http://www.biwug.be or http://twitter.com/biwug.


SharePoint 2013 search open in client


March 26, 2014 - 16:26, by Steven Van de Craen - 1 Comments

Issue

SharePoint 2013 search results uses Excel Calculation Services to open workbooks found in the search results, despite having "open in client" specified on the Document Library and/or the Site Collection level. Notice the URL pointing to _layouts/xlviewer.aspx at the bottom of the screen. In this scenario I only have SharePoint Server 2013 installed without any Office Web Apps servers.
Searching a workbook

 

Initial solution

In my previous encounter with this issue I used a custom Search Result Type with Display Template in order to control the link that is rendered for the search result item.

Item_Excel_Client.html

<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
<head>
<title>Excel Client Item</title>

<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:MasterPageDescription msdt:dt="string">Displays a result tailored for Microsoft Excel documents.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','ServerRedirectedURL':'ServerRedirectedURL','ServerRedirectedEmbedURL':'ServerRedirectedEmbedURL','ServerRedirectedPreviewURL':'ServerRedirectedPreviewURL'</mso:ManagedPropertyMapping>
</mso:CustomDocumentProperties>
</xml><![endif]-->
</head>
<body>
    <div id="Item_Excel_Client">
<!--#_ 
        if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
            var id = ctx.ClientControl.get_nextUniqueId();
            var itemId = id + Srch.U.Ids.item;
            var hoverId = id + Srch.U.Ids.hover;
            var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Excel_HoverPanel.js";
            $setResultItem(itemId, ctx.CurrentItem);
            ctx.CurrentItem.csr_Icon = Srch.U.getIconUrlByFileExtension(ctx.CurrentItem);
            ctx.CurrentItem.csr_OpenApp = "excel";
            ctx.CurrentItem.csr_Path = ctx.CurrentItem.Path;
            ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
            ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
_#-->
            <div id="_#= $htmlEncode(itemId) =#_" name="Item" data-displaytemplate="ExcelItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
                _#=ctx.RenderBody(ctx)=#_                
                <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
            </div>
<!--#_ 
        } 
_#-->
    </div>
</body>
</html>

Item_Excel_Client.js

/* This file is currently associated to an HTML file of the same name and is drawing content from it.  Until the files are disassociated, you will not be able to move, delete, rename, or make any other changes to this file. */

function DisplayTemplate_89a1689efe684e93be8c5bdaa1e46b07(ctx) {
  var ms_outHtml=[];
  var cachePreviousTemplateData = ctx['DisplayTemplateData'];
  ctx['DisplayTemplateData'] = new Object();
  DisplayTemplate_89a1689efe684e93be8c5bdaa1e46b07.DisplayTemplateData = ctx['DisplayTemplateData'];

  ctx['DisplayTemplateData']['TemplateUrl']='~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_Excel_Client.js';
  ctx['DisplayTemplateData']['TemplateType']='Item';
  ctx['DisplayTemplateData']['TargetControlType']=['SearchResults'];
  this.DisplayTemplateData = ctx['DisplayTemplateData'];

  ctx['DisplayTemplateData']['ManagedPropertyMapping']={'Title':['Title'], 'Path':['Path'], 'Description':['Description'], 'EditorOWSUSER':['EditorOWSUSER'], 'LastModifiedTime':['LastModifiedTime'], 'CollapsingStatus':['CollapsingStatus'], 'DocId':['DocId'], 'HitHighlightedSummary':['HitHighlightedSummary'], 'HitHighlightedProperties':['HitHighlightedProperties'], 'FileExtension':['FileExtension'], 'ViewsLifeTime':['ViewsLifeTime'], 'ParentLink':['ParentLink'], 'FileType':['FileType'], 'IsContainer':['IsContainer'], 'ServerRedirectedURL':['ServerRedirectedURL'], 'ServerRedirectedEmbedURL':['ServerRedirectedEmbedURL'], 'ServerRedirectedPreviewURL':['ServerRedirectedPreviewURL']};
  var cachePreviousItemValuesFunction = ctx['ItemValues'];
  ctx['ItemValues'] = function(slotOrPropName) {
    return Srch.ValueInfo.getCachedCtxItemValue(ctx, slotOrPropName)
};

ms_outHtml.push('',''
); 
        if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
            var id = ctx.ClientControl.get_nextUniqueId();
            var itemId = id + Srch.U.Ids.item;
            var hoverId = id + Srch.U.Ids.hover;
            var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Excel_HoverPanel.js";
            $setResultItem(itemId, ctx.CurrentItem);
            ctx.CurrentItem.csr_Icon = Srch.U.getIconUrlByFileExtension(ctx.CurrentItem);
            ctx.CurrentItem.csr_OpenApp = "excel";
            ctx.CurrentItem.csr_Path = ctx.CurrentItem.Path;
            ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
            ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
ms_outHtml.push(''
,'            <div id="', $htmlEncode(itemId) ,'" name="Item" data-displaytemplate="ExcelItem" class="ms-srch-item" onmouseover="', ctx.currentItem_ShowHoverPanelCallback ,'" onmouseout="', ctx.currentItem_HideHoverPanelCallback ,'">'
,'                ',ctx.RenderBody(ctx),'                '
,'                <div id="', $htmlEncode(hoverId) ,'" class="ms-srch-hover-outerContainer"></div>'
,'            </div>'
); 
        } 
ms_outHtml.push(''
,'    '
);

  ctx['ItemValues'] = cachePreviousItemValuesFunction;
  ctx['DisplayTemplateData'] = cachePreviousTemplateData;
  return ms_outHtml.join('');
}
function RegisterTemplate_89a1689efe684e93be8c5bdaa1e46b07() {

if ("undefined" != typeof (Srch) &&"undefined" != typeof (Srch.U) &&typeof(Srch.U.registerRenderTemplateByName) == "function") {
  Srch.U.registerRenderTemplateByName("Item_Excel_Client", DisplayTemplate_89a1689efe684e93be8c5bdaa1e46b07);
}

if ("undefined" != typeof (Srch) &&"undefined" != typeof (Srch.U) &&typeof(Srch.U.registerRenderTemplateByName) == "function") {
  Srch.U.registerRenderTemplateByName("~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_Excel_Client.js", DisplayTemplate_89a1689efe684e93be8c5bdaa1e46b07);
}

}
RegisterTemplate_89a1689efe684e93be8c5bdaa1e46b07();
if (typeof(RegisterModuleInit) == "function" && typeof(Srch.U.replaceUrlTokens) == "function") {
  RegisterModuleInit(Srch.U.replaceUrlTokens("~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_Excel_Client.js"), RegisterTemplate_89a1689efe684e93be8c5bdaa1e46b07);
}

 

Then I pushed the Display Template and Result Type automatically to all Site Collections, because I wanted a uniform experience.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue

function DropFile([Microsoft.SharePoint.SPWeb]$spweb, [string]$fileName, [byte[]]$fileContents)
{
    $spfolderUrl = $spweb.Url + "/_catalogs/masterpage/Display Templates/Search";
    $spfolder = $spweb.GetFolder($spfolderUrl);
    $spfile = $spweb.GetFile("$spfolderUrl\$fileName");
    
    if ($spfile.Exists)
    {
        $spfile.CheckOut();
    }

    $spfile = $spfolder.Files.Add($fileName, $fileContents, $true);
    
    if ($spfile.CheckOutType -ne "None")
    {
        $spfile.CheckIn("");
    }

    $spfile.Publish("");
    $spfile.Approve("");
    
    Write-Host " > Display Template Provisioned."
    
    return $spfile;
}

function CreateSearchResultType([Microsoft.SharePoint.SPWeb]$spweb, [string]$spfileUrl)
{
    $ssa = Get-SPEnterpriseSearchServiceApplication
    $owner = Get-SPEnterpriseSearchOwner -Level SPSite -SPWeb $spweb
    $excelRIT = Get-SPEnterpriseSearchResultItemType -Owner $owner -SearchApplication $ssa | Where Name -eq "Microsoft Excel"
    $rules = $excelRIT.Rules
    $dispProps = $excelRIT.DisplayProperties
    $sptemplateUrl = "~sitecollection/$spfileUrl";
    
    Write-Host $sptemplateUrl;

    Get-SPEnterpriseSearchResultItemType -Owner $owner -SearchApplication $ssa | Where Name -eq "Microsoft Excel (Client)" | Remove-SPEnterpriseSearchResultItemType -Owner:$owner -SearchApplication $ssa -Confirm:$false
    $rit = New-SPEnterpriseSearchResultItemType -Name "Microsoft Excel (Client)" -Owner $owner -SearchApplication $ssa -Rules $rules -DisplayProperties $dispProps -DisplayTemplateUrl $sptemplateUrl
    
    Write-Host " > Search Result Type Created."
    
    return $rit;
}

#########################################

$cd = gl
$fileNames = @("Item_Excel_Client.js", "Item_Excel_Client.html");

Get-SPWebApplication "http://mywebapp" | Get-SPSite -Limit ALL | ForEach {
    $spsite = $_;
    $spweb = $spsite.RootWeb;

    Write-Host $spsite.Url

    # Upload File(s)
    $fileNames | foreach {
        $fileName = $_;
        $fileContents = [System.IO.File]::ReadAllBytes("$cd\$fileName");
        $spfile = DropFile $spweb $filename $fileContents;
    }

    # Register Search Result Type
    $fileUrl = $spfile.Url.Replace(".html", ".js");
    CreateSearchResultType $spweb $fileUrl;
}

Better solution

Recently I stumbled upon the “Preferences” link at the bottom of the search result page. This allows each user to control how links in the search results should be opened.

Search preferences

 

This actually changes the experience for the given user immediately… awesome! I did some digging and it seems to be saved globally to the Search Service Application (Proxy), so all Web Applications and Site Collections making use of the same SSA should give the user a uniform experience.

The question still stands whether this setting can be pushed out programmatically to a specific user or group of users. I was thinking along the lines of the following script, but no luck so far.

$web = Get-SPWeb http://intranet
$ctx = [Microsoft.SharePoint.SPContext]::GetContext($web)
$pref =[Microsoft.Office.Server.Search.Administration.UserPreference]::GetUserPreference($false, $ctx)
$pref

HTH


SharePoint Foundation 2013 broken search experience


December 10, 2013 - 10:33, by Steven Van de Craen - 87 Comments

Issue

I recently examined a SharePoint Foundation 2013 environment where all Search Boxes had gone missing overnight. Also, when browsing to the Search Center I received an error. The ULS logs showed the following error:

System.InvalidProgramException: Common Language Runtime detected an invalid program.

at Microsoft.Office.Server.Search.WebControls.SearchCommon.GetUserAdvancedLanguageSettingsUrl()

at Microsoft.Office.Server.Search.WebControls.ScriptApplicationManager..ctor()

at Microsoft.Office.Server.Search.WebControls.ScriptApplicationManager.GetCurrent(Page page)

at Microsoft.Office.Server.Search.WebControls.SearchBoxScriptWebPart.OnInit(EventArgs e)

at System.Web.UI.Control.InitRecursive(Control namingContainer)

at System.Web.UI.Control.AddedControl(Control control, Int32 index)

at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPartHelper(WebPart webPart)

at System.Web.UI.WebControls.WebParts.WebPartManager.WebPartManagerControlCollection.AddWebPart(WebPart webPart)

at Microsoft.SharePoint.WebPartPages.SPWebPartManager.AddWebPartWithRetry(WebPart webPart)

at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

at Microsoft.SharePoint.WebPartPages.SPWebPartManager.LoadWebParts()

at Microsoft.SharePoint.WebPartPages.SPWebPartManager.OnPageInitComplete(Object sender, EventArgs e)

at System.EventHandler.Invoke(Object sender, EventArgs e)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

KB2837628 and/or KB2850058

It took some investigating but we managed to track down the Windows Updates that seem to cause this issue: http://support.microsoft.com/kb/2837628 and http://support.microsoft.com/kb/2850058. Installing either on a SharePoint Foundation 2013 will break the search infrastructure. Note that these updates CANNOT be uninstalled.

Impact

Other users have also reported the exact same issue and cause on the MSDN forums, but no fix is currently available. The impacted environment had a localized (Dutch) version of SharePoint Foundation 2013 running, other cases also mostly talk about localized versions, so it might be that the English SKU is unaffected.

All versions (both English and localized) of SharePoint Foundation 2013 are impacted.

» http://social.msdn.microsoft.com/Forums/en-US/905c6aac-2ad9-4099-b4a1-d4cdd6ff4b23/kb-2837628-removes-search-box?forum=sharepointsearch

» http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3b403821-42d2-4139-8afb-7c9312b57bd4/search-box-disappeared-foundation?forum=sharepointsearch

» http://blogs.technet.com/b/stefan_gossner/archive/2013/10/26/october-2013-cu-for-sharepoint-2013-has-been-released.aspx (Comments section)

» http://social.technet.microsoft.com/Forums/sharepoint/en-US/4714d906-5bbe-4eca-b666-b0e65367a0a3/update-kb2850058-breaks-search?forum=sharepointsearch

Reproduce

Initially I was unable to reproduce this issue as the aforementioned update wouldn’t install (“The expected version of the product was not found on this system”), but ultimately I did find how it probably ended up on impacted systems.

  1. Install SharePoint Foundation 2013
  2. Install SharePoint Server 2013 March Public Update
  3. Install KB2837628 and/or KB2850058

So basically if you run the Server PU (and maybe this applies to CU’s as well) on a Foundation it will update without issues, but then Windows Updates will start rolling out SharePoint Server 2013 updates. If this is an unsupported scenario they should have a blocking mechanism to avoid installing Server PU’s or CU’s onto a Foundation.

Solution: KB2760625

The October 2013 or December 2013 Cumulative Update do NOT fix this issue. For now avoid installing this update altogether. It isn’t supposed to wind up on Foundation installations.

I’m currently working together with Microsoft PSS to get to the bottom of this and -hopefully- a hotfix.

An hotfix has been released and confirmed to fix the issue: KB2760625 (http://support.microsoft.com/kb/2760625). After installation the Configuration Wizard needs to be run.

This hotfix should be incorporated into the April 2014 Cumulative Update, so once that is available there shouldn’t be a need to install this specific hotfix separately.

 

Update (12/12/2013)

There’s are reports that KB2850058 has the same impact, so be careful! but this appears to be false. This update is related to Outlook 2007 Junk Email Filter. I can now confirm this (17/12/2013).

» http://social.technet.microsoft.com/Forums/sharepoint/en-US/4714d906-5bbe-4eca-b666-b0e65367a0a3/update-kb2850058-breaks-search?forum=sharepointsearch

I have also logged this as a support case with Microsoft, let’s hope this can clear the mist. I’ll update my findings here and on the above forums.

Update (13/12/2013)

It appears that English installations of SharePoint Foundation 2013 are also impacted.

I’m still working with PSS to get this resolved.

I haven’t been able to reproduce the issue on my dev environment. I tried WS2012 and WS2008R2 but KB2837628 seems unwilling to install (“The expected version of the product was not found on the system.”). If anyone has reproducible steps please let me know.

Update (14/12/2013)

Managed to reproduce the issue. See above for the reproduce steps.

I verified KB2850058 on my installation. It wouldn’t install because I didn’t have Outlook 2007 on it, but it appears to be unrelated since it is an update for the Outlook 2007 Junk Email Filter. Most likely both updates were installed on the environment of the user that reported this. I had my numbers screwed up.

Update (16/12/2013)

I tried the recently released December 2013 Cumulative Update but no luck.

Microsoft PSS is still examining the issue. To be continued.

Update (17/12/2013)

After getting notified that KB2850058 was really also causing this issue, I retraced my steps and I had gotten the KB numbers wrong. So we have both KB2837628 and KB2850058 causing the same issues. Thanks Lee and Matt for informing me on this via the comments below!

Update (23/12/2013)

I don’t expect a solution to be provided in the next few weeks :(

Update (4/02/2014)

I finally have an update to share after weeks of back-and-forth emailing regarding the issue. I’m absolutely not happy with the answer and have expressed my sentiment accordingly. Still, I doubt that will make an impression on anyone. Here’s the update;

The Product Group is acknowledging the problem but declared that they can only fix it over the April 2014 CU as there will be no February 2014 CU.

This means for the affected customer that cannot wait until April need to reinstall SharePoint in order to address  the error in a supported manner. Some other customers tried to replace binaries with older versions, we haven’t yet received the feedback if this worked out for them – we are asked to discourage this kind of experiments anyway.

Update (5/02/2014)

A final word from the escalation engineer was that this is an acknowledged bug, but due to the release cycles of hotfixes and updates this issue cannot be fixed any sooner than the April 2014 Cumulative Update. Since this is well over two months away from now you’d be best in reinstalling your environment and avoid those specific Windows Updates, or live without Search until then.

Update (4/03/2014)

Service Pack 1 for SharePoint Foundation 2013 does not fix this issue. Furthermore, the KB for Service Pack 1 was amended with a notice to postpone installing SharePoint Foundation 2013 Service Pack 1.

Important A known issue in SharePoint Foundation 2013 SP1 can affect the functionality of the Search WebPart. We encourage you to limit production installations of SharePoint Foundation 2013 SP1 until a fix is available. SharePoint Server 2013 is not affected by this issue.

http://support.microsoft.com/kb/2850035

Update (20/03/2014)

A hotfix has finally been released: http://support.microsoft.com/kb/2760625! Make sure to run the Configuration Wizard afterwards.


Get the Search Service Application for a specific site (programmatically)


October 30, 2013 - 13:46, by Steven Van de Craen - 0 Comments

I needed to get a reference to the Microsoft.Office.Server.Search.Administration.SearchServiceApplication instance for a given Microsoft.SharePoint.SPSite instance.

Here’s how you can do this in C#. I created it as an Extension Method.

public static SearchServiceApplication GetSearchServiceApplication(this SPSite site)
{
    SearchServiceApplication result = null;

    if (site != null)
    {
        SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy(SPServiceContext.GetContext(site));

        if (proxy != null)
        {
            Guid ssaId = proxy.GetSearchServiceApplicationInfo().SearchServiceApplicationId;
            result = SearchService.Service.SearchApplications[ssaId] as SearchServiceApplication;
        }
    }

    return result;
}

And here’s the PowerShell counterpart. I’m no scripting guru so this might be improved here and there.

function GetSearchServiceApplication([Microsoft.SharePoint.SPSite] $site)
{
    if ($site -ne $null)
    {
        $proxy = [Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy]::GetProxy([Microsoft.SharePoint.SPServiceContext]::GetContext($site));

        if ($proxy -ne $null)
        {
            [System.Guid] $ssaId = $proxy.GetSearchServiceApplicationInfo().SearchServiceApplicationId;
            $result = [Microsoft.Office.Server.Search.Administration.SearchService]::Service.SearchApplications | ? { $_.Id -eq $ssaId };
        }
    }

    return $result;
}

May it serve you well!


SharePoint Server 2010 and PDF Indexing


January 5, 2012 - 11:22, by Steven Van de Craen - 0 Comments

Posting this for personal reference:

SharePoint 2010 - Configuring Adobe PDF iFilter 9 for 64-bit platforms

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf]
@=hex(7):7b,00,45,00,38,00,39,00,37,00,38,00,44,00,41,00,36,00,2d,00,30,00,34,\
  00,37,00,46,00,2d,00,34,00,45,00,33,00,44,00,2d,00,39,00,43,00,37,00,38,00,\
  2d,00,43,00,44,00,42,00,45,00,34,00,36,00,30,00,34,00,31,00,36,00,30,00,33,\
  00,7d,00,00,00,00,00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\Filters\.pdf]
"Extension"="pdf"
"FileTypeBucket"=dword:00000001
"MimeTypes"="application/pdf"

reg-file sps2010pdf.reg


SharePoint Search Scopes: Approximate Item Count is incorrect


March 18, 2010 - 15:28, by Steven Van de Craen - 1 Comments

The Scope Item Count gives an approximate number of items matching the scope. However at one of my customers it showed only six items for their entire file share !?

image

There were no Crawl Rules and the Crawl Logs showed tens of thousands of successfully crawled items so what could be wrong ? I played with the scope rules (recreated them, inverse logic, etc) but no luck. I opened up Reflector on the Scope Count property to find that it is calculated through a Search Query. Then it hit me that the account I logged in to to perform Search Administration was a local account that didn’t have access to the file share, thus the Query for returning Scope Count would security trim those results for me.

I’d expect any SharePoint Administrator to get a correct count of items in the Scope so this seems like a minor design flaw to me.


SharePoint Search indexes some files with fldXXXX_XXXX file names


January 20, 2010 - 16:00, by Steven Van de Craen - 0 Comments

Today I visited a customer to solve an issue that I had run into a while ago in my post regarding ZIP file indexing with IFilters. The customer was indexing Office 2003 documents on a file share (.doc, .xls, .rtf, …) and had the issue of the Filename property having the strange value of fld and some numbers. This only occurred on their x64 live environment and not on a x86 test environment.

 

I looked at the IFilter overview using Citeknet IFilter Explorer (great tool !) and also the offfilt.dll (IFilter for the aforementioned file types) to check on version differences between the two systems but there were none.

Both environments were running SP2 and June 2009 Cumulative Update but since there aren’t that many obvious options I went for installing the November 09 Cumulative Update and that did the trick. Guess that the issues that was fixed for quite some time on x86 is only recently handled for x64 environments. Either way, everyone happy.

Hope it helps.


Wildcard Search for MOSS 2007


September 23, 2009 - 17:43, by Steven Van de Craen - 4 Comments

Wildcard search is a much discussed topic in SharePoint Land and generally I reuse my custom XML Web Part to solve the issue; build the query, issue the query,  read the result XML and transform using XSL.

Downside to this solution is the lack of paging and other functionality (Search Alerts, RSS Feed, Statistics, Paging, …) you get with the out of the box Search Web Parts in Microsoft Office SharePoint Server 2007 or Microsoft Search Server 2008.

So I decided to deep dive into the SearchHiddenResultObject using Reflection and whipped up my own Wildcard Core Results Web Part. Downside with any wildcard search implementation is that you lose some functionalities.

When I was ready to blog my findings I discovered Corey Roth had blogged this already along with his WildcardSearch on Codeplex project. A shame but having discovered his truly excellent blog eased the pain ;)

Anyway here’s the download for mine:

STSADM -o addsolution -filename VNTG.WildcardSearch.wsp
STSADM -o deploysolution -name VNTG.WildcardSearch.wsp -allowgacdeployment -immediate -allcontenturls


 Next >>