I have a search results webpart that in test mode it shows 6 results, in render mode it shows 5 results.

When I used the search query tool there is one duplicate. When I check the 2 files, the names are similar but not equal, and the content of the pdf file is also similar, but not equal.

The only workaround I found is this one http://thesharepointlife.com/2013/04/sharepoint-2013-search-not-display-all-results-2/

but I wonder if this can be changed in a different way, it would be very annoying if I have to this for all my search webparts.


Here is a way of changing it with powershell (still needs to be done per webpart though..)

# Author: Mikael Svenson - @mikaelsvenson
# Company: Puzzlepart
# Date: December, 2013
# Reference: http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in-PowerShell-scripts-with-Office365.html

# replace these details (also consider using Get-Credential to enter password securely as script runs).. 
$username = "username@something.onmicrosoft.com"
$password = "password"
$url = "https://company.sharepoint.com/search"
# the path to the SharePoint Client dlls' 
$dllPath = "D:\SP2013-dll\ISAPI\"

$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force

Add-Type -Path "$($dllPath)Microsoft.SharePoint.Client.dll"
Add-Type -Path "$($dllPath)Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "$($dllPath)Microsoft.SharePoint.Client.Publishing.dll"
Add-Type -Path "$($dllPath)Microsoft.SharePoint.Client.Taxonomy.dll"

# connect/authenticate to SharePoint Online and get ClientContext object.. 
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 

#$credentials = New-Object System.Net.NetworkCredential($username, $securePassword) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) 
$clientContext.Credentials = $credentials

if (!$clientContext.ServerObjectIsNull.Value) 
    Write-Host "Connected to SharePoint site: '$Url'" -ForegroundColor Green 

$web = $clientContext.Web
# get guid of the default Pages library to cater for localization
$pagesGuid = $web.AllProperties.FieldValues["__PagesListId"]
$list = $web.Lists.GetById($pagesGuid)
# get localized server relative url
$url = $list.RootFolder.ServerRelativeUrl

$page = $web.GetFileByServerRelativeUrl($url +"/results.aspx");

Write-Host "Checking out page" -ForegroundColor Green 
catch{ Write-Host "Page already checked out" -ForegroundColor Yellow}
$wpm = $page.GetLimitedWebPartManager([Microsoft.SharePoint.Client.WebParts.PersonalizationScope]::Shared) 
for ($i=0; $i -lt $wpm.WebParts.Count; $i++)
    $item = $wpm.WebParts.Item($i)
    if( $item.WebPart.Title -eq "Search Results" ) {
        Write-Host "Found result web part" -ForegroundColor Green 

Write-Host "Turning off trimming of duplicates" -ForegroundColor Green
# Read JSON properties and convert to an object
$dataProvider = ConvertFrom-Json $item.WebPart.Properties["DataProviderJSON"]
$dataProvider.TrimDuplicates = $false
# Convert the object back to a JSON string
$item.WebPart.Properties["DataProviderJSON"] = ConvertTo-Json $dataProvider -Compress
Write-Host "Checking in and publishing page" -ForegroundColor Green 
$page.CheckIn("Modified Search Core Results web part", [Microsoft.SharePoint.Client.CheckinType]::MajorCheckIn)
$page.Publish("Modified Search Core Results web part")

From http://techmikael.blogspot.se/2013/12/duplicate-trimming-in-sharepoint-2013.html This script can work both on premise and in the cloud!

|improve this answer|||||

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.