Skip to main content

Are you not seeing all results when searching for documents in Sharepoint? Are you confident that there is another, newer version? Then probably it’s filtered out by Sharepoints duplicate content removal in the search results. A document does not have to be 100% similar to be flagged as duplicate, similar documents or sites seems to be removed also.

You can’t change this behavior for the default search boxes in Sharepoint online (the one in the top left corner), but you can change the classis search page at (https://contoso.sharepoint.com/search).

Disabling Duplicate Removal

To disable the duplicate removal in the classic search page we need to use a javascript to create a checkbox that allows you to show or hide the duplicate content.

Go the classic search page and edit the page. We are going to add a Script Editor web part to the search page and insert the code below.  Click on Add Web Part and go to the Category  Media and Content and select the Script Editor

1.  // SRC: http://www.sharepointsearch.net/disable-duplicate-removal-in-sharepoint-search/
2.
3.  <div id="dupframe">
4.  <input id="duplicates" type="checkbox" value="duplicates" name="duplicates">
5.   <label for="duplicates">Show duplicates</label>
6.  </div>
7.  <script>
8.  // Show duplicated results
9. 
10. document.getElementById('dupframe').style.float="left";
11. document.getElementById('dupframe').style.position="relative";
12. document.getElementById('dupframe').style.left="120px";
13. 
14. var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
15. if (is_chrome) {
16.     document.getElementById('dupframe').style.top="7px";
17. }
18. else 
19. {
20.     document.getElementById('dupframe').style.top="9px";
21. }
22. 
23. if (typeof Srch.U.fillKeywordQuery !== 'undefined') {
24.     var originalFillKeywordQuery = Srch.U.fillKeywordQuery;
25.     Srch.U.fillKeywordQuery = function(query, dp) {
26.         if (document.getElementById('duplicates').checked) {
27.             // Set the trim duplicates property to false
28.             dp.set_trimDuplicates(false);
29.         } else {
30.             // Set the trim duplicates property to true
31.             dp.set_trimDuplicates(true);
32.         }
33.         // Call the default function to go further with the query processing
34.         originalFillKeywordQuery(query, dp);
35.     };
36. }
37. </script>

Save and publish the page. You can now search for content with or without the filtering of duplicates.

References : Peter Angehrn