The other day one of our users was experiencing a strange issue where different searches could turn up similar files, but the files could never be found using the same search terms (even though they had the same partial filename which was being searched for). Take, for example, 2 PDF files named:
PN 1234567 LN 1234.pdf
PN 1234567 LN 6789.pdf
Searching for “1234567” would only show the first file, yet searching for “6789” would show the second file. Searching for either “PN” or “LN” would again, only show the top file. Both were scanned PDFs with no other significant metadata (they both had the same values). Well Microsoft likes to think that they know better what it is that you’re really looking for, so SharePoint decides to hide what it considers to be duplicate files. In this case, even though the PDFs were different and had different filenames, SharePoint’s algorithm for determining what is a (near) duplicate file was concluding that the files were indeed duplicates, and so hiding one result whenever the other was present. One way of being able to see the duplicate files, is to configure the Search Results web part to “Show View Duplicates Link”, but all this does is provide a link in the document preview which, when clicked, will list the duplicate files. However, this is not exactly very useful as we needed all of the files listed in the search results right off the bat.
Attempting to modify the Search Results web part directly in SharePoint Designer causes some funky errors with all of the Search related web parts (Search Box, Refiners, etc) on the page, which cannot be undone. The best way I found to achieve this is to export the Search Results web part, then modify the web part file, and upload it again, and add it on the page using the following steps:
- Edit the page which the Search Results web part lives
- Choose “Export WebPart” and save it on your computer
- Edit the WebPart using Notepad, and search for “TrimDuplicates”
- You should see it in a JSON string looking like this “TrimDuplicates”:true
- Change the “true” to “false”
- Save the WebPart file
- Add a WebPart on your page and choose Upload WebPart
- Once your WebPart is uploaded, choose Add WebPart again and pick the Search Results web part that you just uploaded
- Voila. Duplicates abound!