Select Page

Including duplicates in SharePoint search results

If you have two very similar files, it can happen that the SharePoint search API recognize them  as duplicate files.

This all happens because of the the iFilter architecture on which the SharePoint Search relays on: from each file is first the pure text being extracted, and then, this text is indexed.

Now, if two texts are very similar – SharePoint is going to consider them as duplicates. So, it can happen that you have a PowerPoint presentation and a Word document with a very similar content – only one is going to be found. The other is considered as duplicate…

Well, in the "Search results" webpart in the search center site you can unselect the "Remove duplicate results" checkbox.

duplicateresults_78EC2262

In the code, when using SharePoint Search API, you have to set the "TrimDuplicates" property of your Query object to false:

//
// create a new FullTextSqlQuery class
FullTextSqlQuery myQuery = new FullTextSqlQuery(m_SharePointSite);
//
//...
//
//search results
myQuery.ResultTypes = ResultType.RelevantResults;
myQuery.TrimDuplicates = false;
//
// execute the query and load the results into a datatable
ResultTableCollection queryResults = myQuery.Execute();

Please pay attention on the underlined source code line…

And that would be all…

Previous

Next