You are here: C++ API > Classes > dtsSearchJob Structure > dtsSearchJob::maxFilesToRetrieve2 Data Member
dtSearch Text Retrieval Engine Programmer's Reference
dtsSearchJob::maxFilesToRetrieve2 Data Member

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

long maxFilesToRetrieve2;

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

Regardless of the maxFilesToRetrieve2 setting, totalFiles will return the a count that includes all matching documents. maxFilesToRetrieve2 limits the number of items saved in the returned dtsSearchResults, 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 search results 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 searchFlags2, the most recent documents will be returned instead of the most relevant.