You are here: C++ Support Classes > dtSearch Namespace > Classes > DSearchJob Class > OnFound Method
> DSearchJob::OnFound Method (long, long, const char *, long, dtsSearchNotificationItem&)
DSearchJob::OnFound Method (long, long, const char *, long, dtsSearchNotificationItem&)
Close
dtSearch Text Retrieval Engine Programmer's Reference
DSearchJob::OnFound Method (long, long, const char *, long, dtsSearchNotificationItem&)

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);
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.

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.

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); } };