You are here: C++ Support Classes > dtSearch Namespace > Classes > DSearchJob Class > DSearchJob::SetMaxFiles Method
DSearchJob::SetMaxFiles Method
Close
dtSearch Text Retrieval Engine Programmer's Reference
DSearchJob::SetMaxFiles Method

After a search, DSearchJob will return a DSearchResults object that contains up to this many files. If more files were retrieved than the MaxFilesToRetrieve value, only the best-matching files will be returned.

Syntax
C++
void SetMaxFiles(long aMaxFiles);
Parameters
Description
long aMaxFiles
The maximum number of files to allow this search to retrieve.

When MaxFilesToRetrieve is non-zero, it controls the maximum size of the DSearchResults 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 MaxFilesToRetrieve setting, GetTotalFiles will return the a count that includes all matching documents. MaxFilesToRetrieve limits the number of items saved in the returned DSearchResults, 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 SearchFlags, the most recent documents will be returned instead of the most relevant.