none
The total number of SharePoint Advanced Search results is off by one RRS feed

  • Question

  • We used SharePoint Advanced Search to search for documents with a criteria and it found 597 documents:

    We knew we should have 598 documents instead. We went to the destination folder and found out there were actually 598 documents matching the criteria:

    What could be the reasons to cause the discrepancy?

    Thanks,

    Yong


    • Edited by yongcao Tuesday, February 4, 2020 7:42 PM
    Tuesday, January 21, 2020 12:18 AM

Answers

  • Hi Yong,

    Per my research, I couldn't find articles about getting search results in SharePoint 2010 using PowerShell.

    For your issue, please try to reset the index and do a full crawl to compare the result.

    https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server-2010/ff621079(v=office.14)?redirectedfrom=MSDN

    In addition, please check whether you enable the "Trim duplicates" in search results web part.

    If true, refer below article about how to disable it:

    https://www.wikitechy.com/fix-error/how-disable-trimDuplicates-in-the-search-result-webpart-under-SharePoint

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best regards,

    Julie 


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by yongcao Wednesday, February 5, 2020 1:34 AM
    Thursday, January 30, 2020 6:50 AM
  • Here is a summary of the root cause and the solution:

    From time to time we have two files which are almost identical. SharePoint uses a hashing technique and a document signature to determine if the file is a duplicate. The files that contain a bulk of content identical to each other are considered duplicates. These two files are actually Near Duplicates instead of Duplicates and we want to be able to search both of them.

    The setting that enables the "Remove Duplicate Results" feature (which is on by default) in a Search Center is available at the Search Core Results Web Part, under the section Result Query Options, as shown below:

    Clear the check for "Remove Duplicate Results" and publish the change.

    Thank you, Julie, for your help!

    Yong
    • Edited by yongcao Tuesday, February 4, 2020 7:39 PM
    • Marked as answer by yongcao Wednesday, February 5, 2020 1:34 AM
    Tuesday, February 4, 2020 7:36 PM

All replies

  • Hi Yong,

    Please check the crawl log to find if any errors that are present.

    If not, please ensure the missing file meets the KQL Syntax you searched, try to use one of syntaxs such as “Write=1/8/2020”and check the result.

    And we could also use the following PowerShell to check if the MaxRowLimit is over 598:

    $ssa = Get-SPEnterpriseSearchServiceApplication
    
    $ssa.MaxRowLimit

    Best regards,

    Julie


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, January 21, 2020 8:25 AM
  • Thank you, Julie, for your information.

    I ran the PowerShell script and got the following error:

    PS C:\> Get-SPEnterpriseSearchServiceApplication
    Get-SPEnterpriseSearchServiceApplication : Microsoft SharePoint is not supported with version 4.0.30319.42000 of the Microsoft .Net Runtime.
    At line:1 char:1
    + Get-SPEnterpriseSearchServiceApplication
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (Microsoft.Offic...viceApplication:GetSearchServiceApplication) [Get-SPEnterpriseSearchServiceApplication
       ], PlatformNotSupportedException
        + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.GetSearchServiceApplication

    But I think the issue might not be with MaxRowLimitMost of the times, the counts from the Advanced Search results are correct. There are a fews days this year the counts were off by one:

    Content Type

    Date Committed

    Actual Committed 

    Advanced Search

    Signature card

    Jan 17-2020

    368

    367

    Signature card

    Jan 08-2020

    598

    597

    Signature card

    Dec 31-2019

    637

    636

    It would be a little easier if we can find the missing file so that we can find out what makes it special. But it is very tedious to find it by comparing these two lists.

    Can we add a column for filename in the Advanced Search results, or create a PowerShell script to get the search results? Any suggestion will be appreciated.

    Thanks,

    Yong

    • Edited by yongcao Wednesday, January 22, 2020 3:34 AM
    Wednesday, January 22, 2020 3:20 AM
  • Hi Yong,

    Please refer below PowerShell to get search results:

    [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.Office.Server.Search.Query”)
    Write-Host “`r`n”
    
    $site = Get-SPSite http://localhost
    $keywordQuery = New-Object Microsoft.Office.Server.Search.Query.KeywordQuery($site)
    $keyword = Read-Host “Search Term”
    $keywordQuery.QueryText = $keyword
    $searchExec = New-Object Microsoft.Office.Server.Search.Query.SearchExecutor
    $searchResults = $searchExec.ExecuteQuery($keywordQuery)
    
    Write-Host “`r`n”
    $table = $searchResults.Table
    Write-Host $table.Length” Results Found” -BackgroundColor “Green” -ForegroundColor “Black”
    $table | select Title, Path, Author, LastModifiedTime, IsDocument

    And here are some articles for your reference:

    Get Search Results in SharePoint 2013 using PowerShell

    PowerShell to Search SharePoint and Export Results to CSV using Keyword Query

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best regards,

    Julie


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, January 22, 2020 11:37 AM
  • Hi Yong,

    Is there any progress on this issue?

    I am looking forward to your feedback if there is any update.

    Best regards,

    Julie


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, January 27, 2020 1:23 AM
  • Hi Julie,

    Thank you for your PowerShell script and the links to 2 references. But I noticed that the class Microsoft.Office.Server.Search.Query.SearchExecutor was introduced in SharePoint 2013 and does not run on our SharePoint 2010.

    Best regards,

    Yong
    Monday, January 27, 2020 6:09 AM
  • I found another article How to: Query SharePoint Search with PowerShell - Corey .... It said "Filed under: ."

    Here is my code:

    Param([string] $queryText, [string] $siteCollectionUrl)
    
    $queryText = 'SPContentType="Signature Card"'
    $siteCollectionUrl = 'http://imagingdev/Sites/Search/'
    
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Search")
    
    $clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($siteCollectionUrl)
    
    $keywordQuery = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($clientContext)
    $keywordQuery.QueryText = $queryText
    
    $searchExecutor = New-Object Microsoft.SharePoint.Client.Search.Query.SearchExecutor($clientContext)
    
    $results = $searchExecutor.ExecuteQuery($keywordQuery)
    
    $clientContext.ExecuteQuery()
    
    $results.Value[0].ResultRows
    
    foreach($result in $results.Value[0].ResultRows)
    {
        Write-Host $result["Title"] Write-Host $result["Path"] Write-Host $result["Write"]
        Write-Host
    }

    But I got an exception:

    Exception calling "ExecuteQuery" with "0" argument(s): "Cannot find proxy for type with id "{80173281-fffd-47b6-9a49-312e06ff8428}"."
    At C:\Scripts\SearchQuery.ps1:20 char:1
    + $clientContext.ExecuteQuery()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ServerException

    Does anyone know if this script work for SharePoint 2010? 

    Thanks,

    Yong

    Wednesday, January 29, 2020 9:51 PM
  • Hi Yong,

    Per my research, I couldn't find articles about getting search results in SharePoint 2010 using PowerShell.

    For your issue, please try to reset the index and do a full crawl to compare the result.

    https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server-2010/ff621079(v=office.14)?redirectedfrom=MSDN

    In addition, please check whether you enable the "Trim duplicates" in search results web part.

    If true, refer below article about how to disable it:

    https://www.wikitechy.com/fix-error/how-disable-trimDuplicates-in-the-search-result-webpart-under-SharePoint

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best regards,

    Julie 


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by yongcao Wednesday, February 5, 2020 1:34 AM
    Thursday, January 30, 2020 6:50 AM
  • Hi Julie,

    Thank you for your help.

    We actually reset the index and did a full crawl but it did not solve the problem. We just found two files (not via PowerShell script) which are "Near Duplicates" and the SharePoint thinks they are "Duplicates". We are going to enable the duplicate results. Will let you know the results.

    Thanks,

    Yong
    Thursday, January 30, 2020 7:35 PM
  • Here is a summary of the root cause and the solution:

    From time to time we have two files which are almost identical. SharePoint uses a hashing technique and a document signature to determine if the file is a duplicate. The files that contain a bulk of content identical to each other are considered duplicates. These two files are actually Near Duplicates instead of Duplicates and we want to be able to search both of them.

    The setting that enables the "Remove Duplicate Results" feature (which is on by default) in a Search Center is available at the Search Core Results Web Part, under the section Result Query Options, as shown below:

    Clear the check for "Remove Duplicate Results" and publish the change.

    Thank you, Julie, for your help!

    Yong
    • Edited by yongcao Tuesday, February 4, 2020 7:39 PM
    • Marked as answer by yongcao Wednesday, February 5, 2020 1:34 AM
    Tuesday, February 4, 2020 7:36 PM
  • Hi Yong,

    Congratulations on solving this issue and thanks for sharing your solution.

    It will do great help to those who meet the similar question in this forum.

    If you find the reply helpful to you, please remember to mark it as answer.

    Thanks again for your contribution.

    Best regards,

    Julie


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, February 5, 2020 1:08 AM