2

It's obvious. Resetting the search index clears all search results. It does however not remove all crawled and managed properties. SharePoint (2013) remembers them forever.

The only option to remove them entirely is to provision a new search service application. This can hardly be the best tool for the task.

How do YOU get rid of old/invalid/orphaned search index properties?

I know you can remove a managed property to crawled property mapping. And then go forth and "delete all unmapped crawled properties" or whatever it is called. In my opinion this never did anything useful.

2

I have put together a quick PS scrip that should allow you to find, list and then remove unmapped properties. I adapted this from a script I've used before to remove all mapped properties Vadim's Blog.

Hope it helps.

$searchAppName = "Search Service Application"  
$categoryName = "Business Data"  

function RemoveCrawledProperty($crawledPropertyName)  
{  
    $category = Get-SPEnterpriseSearchMetadataCategory -Identity $categoryName -SearchApplication $searchAppName  
    $crawledProperty =  
        Get-SPEnterpriseSearchMetadataCrawledProperty -Name $crawledPropertyName -SearchApplication $searchAppName -Category $category  
    if ($crawledProperty)  
    {  
        $mappings = Get-SPEnterpriseSearchMetadataMapping -SearchApplication $searchAppName -CrawledProperty $crawledProperty  
        if ($mappings)
        {
            continue
        }  
        else  
        {  
            Write-Host "No mappings found for '$crawledPropertyName'." -foregroundcolor yellow  
        }  
        $category.DeleteUnmappedProperties()  
    }  
    else  
    {  
        Write-Host "Crawled property '$crawledPropertyName' not found." -foregroundcolor yellow  
    }  
}  
  • The removed crawled properties will be added back by SharePoint on next full crawl? – Mark L Aug 24 '16 at 1:37
2

I alterd the script of @Benjooster because it doesn't work for me on SharePoint 2013. You need to pass a SearchServiceApplication object as a parameter instead off the name. Also when a crawled property has the option include in idex set to true it won't be deleted. You also need to do an $category.Update()

properties will be back when you do a full crawl. Do restart the Search host controller first. Crawled properties are cached. See https://blogs.technet.microsoft.com/sharepointdevelopersupport/2013/06/04/crawled-properties-wont-re-appear-after-deletion-for-a-custom-xml-indexing-connector-in-sharepoint-2013/

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$categoryName = "SharePoint"  

function RemoveCrawledProperty($crawledPropertyName)  
{  
    Write-Host "If a CrawledProperty has option include in index enabled it won be deleted" -foregroundcolor green  

    $searchapp = Get-SPEnterpriseSearchServiceApplication
    #$category = Get-SPEnterpriseSearchMetadataCategory -Identity $categoryName -SearchApplication $searchAppName  
    $category = Get-SPEnterpriseSearchMetadataCategory -Identity $categoryName -SearchApplication $searchapp  
    $crawledProperty = Get-SPEnterpriseSearchMetadataCrawledProperty -Name $crawledPropertyName -SearchApplication $searchAppName -Category $category  
    if ($crawledProperty)  
    {  
        Write-Host "CrawledProperty found for '$crawledPropertyName'." -foregroundcolor yellow  
        $mappings = Get-SPEnterpriseSearchMetadataMapping -SearchApplication $searchAppName -CrawledProperty $crawledProperty  
        if ($mappings)
        {
            Write-Host "Mappings found for '$crawledPropertyName'." -foregroundcolor yellow  
            continue
        }  
        else  
        {  
            Write-Host "No mappings found for '$crawledPropertyName'." -foregroundcolor yellow  
        }  
        $category.DeleteUnmappedProperties()  
        $category.Update()
    }  
    else  
    {  
        Write-Host "Crawled property '$crawledPropertyName' not found." -foregroundcolor yellow  
    }  
}  

RemoveCrawledProperty "<name of property>"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.