1/22/2018

SharePoint Search Weirdness – Part 5: Search REST API Ignores Duplicates


A continuation of the "Search Weirdness" series!


If you are a developer, or a SharePoint 2013 workflow designer, then you probably have used the SharePoint Search REST API. Did you know that you are probably not getting all of the results expected?

Here’s a typical REST search for the word “sharepoint”:

http://yourSiteUrl/_api/search/query?querytext='sharepoint'

Or if you would like to be a little more selective:

http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'

or you would like to return more than the default number of items:

http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&rowlimit=1000


The problem with the above searches is that Search thinks some of your results are duplicates, so it removed them! To solve this problem just add this to your URL:

    &trimduplicates=true

Your search URLs then might look like these:

http://yourSiteUrl/_api/search/query?querytext='sharepoint'&trimduplicates=true

http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&trimduplicates=true

http://yourSiteUrl/_api/search/query?querytext='sharepoint'&selectproperties='Title,Author'&refinementfilters='fileExtension:equals("docx")'&rowlimit=1000&trimduplicates=true


.

1 comment:

Rimayug said...

Hi,
I think you mean '&trimduplicates=false' as '&trimduplicates=true' will trim the duplicates

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.