Close
dtSearch Engine API for .NET Framework 2.x-4.x 2024.01
SearchJob::MaxFilesToRetrieve Property

Limit the maximum size of search results to a specified number of files.

public int MaxFilesToRetrieve;

When MaxFilesToRetrieve is non-zero, it controls the maximum size of the SearchResults that can be returned after a search. The most relevant documents from all matching documents in the index will be included in SearchResults.  

Regardless of the MaxFilesToRetrieve setting, SearchJob.FileCount will return the a count that includes all matching documents. MaxFilesToRetrieve limits the number of items saved in SearchResults, but it does not stop the search before all matching documents have been identified.  

For example, if you set MaxFilesToRetrieve=10 and AutoStopLimit=5000, then SearchResults will contain the 10 most relevant documents from the first 5000 found. Documents after the first 5000 found will not be considered, because AutoStopLimit=5000 will force the search to halt after 5000 matching documents are found.  

If the dtsSearchSelectMostRecent flag is set in SearchFlags, the most recent documents will be returned instead of the most relevant.