Each time a document is retrieved, this function will be called.
Syntax
C++
virtual void OnFound(long totalFiles, long totalHits, const char * name, long hitsInFile, dtsSearchNotificationItem& item);
Group
Parameters
Parameters |
Description |
---|---|
long totalFiles |
Total number of files found so far |
long totalHits |
Total number of hits found so far |
const char * name |
Name of the file retrieved |
long hitsInFile |
Number of hits in this file |
dtsSearchNotificationItem& item |
Document properties (these will be mostly empty of the dtsSearchDelayDocInfo SearchFlags flag was set. |
Remarks
An application can call DSearchJob::VetoThisItem from the OnFound callback to prevent the item from being included in search results. An application can call DSearchJob::SetItemScore from the OnFound callback to change the item score in search results.
Example
CMySearchJob : public DSearchJob {
public:
...
virtual void OnError(long errorCode, const char *msg) {
// First call base class implementation
DSearchJob::OnError(errorCode, msg);
// Now show the message to the user
CString csMsg = GetMyErrorForErrorCode(errorCode);
ShowMessageToUser(csMsg);
}
virtual void OnFound(long totalFiles, long totalHits,
const char *name, long hitsInFile, dtsSearchResultsItem& item) {
// First call base class implementation
DSearchJob::OnFound(totalFiles, totalHits, name, hitsInFile, item);
// Now show the file to the user
ShowFoundFileToUser(name);
}
};