Links
dtSearch Text Retrieval Engine Programmer's Reference
Monitoring Index Jobs in C++
Monitoring Index Jobs | Send Feedback

How to monitor the progress of an index update in C

Remarks

To monitor the progress of an IndexJob in the C++ API: 

(1) Derive a class from DIndexJob and 

(2) Implement a virtual function, OnProgressUpdate(dtsIndexProgressInfo& info) to receive notifications. 

Each time OnProgressUpdate is called, the dtsIndexProgressInfo.updateType will indicate the reason for the notification. The updateType is a MessageCode value that indicates when, for example, a file was successfully indexed (dtsnIndexFileDone) or could not be indexed due to an error (dtsnIndexFileOpenFail, dtsnIndexFileEncrypted). Example:

class MyIndexJob : public DIndexJob {
    // The indexer will call OnProgressUpdate with many different types of notifications as the
    // update proceeds.
    virtual void OnProgressUpdate(dtsIndexProgressInfo& info) {
        if (info.updateType == MessageCode.dtsnIndexFileDone)
            cout << "Indexed: " << info.file.name << '\n';
        else if (info.updateType == MessageCode.dtsnIndexFileOpenFail)
            cout << "Not Indexed: " << info.file.name << " reason: " << info.file.openFailMessage << '\n';
        else if (info.updateType == MessageCode.dtsnIndexFileEncrypted)
            cout << "Encrypted: " << info.file.name << '\n';

        // Call DIndexJob::Cancel() to stop the index update
        if (userClickedCancelButton())
            Cancel();
        }
};
Group
Links
You are here: Overviews > Monitoring Index Jobs > Monitoring Index Jobs in C++
Copyright (c) 1995-2008 dtSearch Corp. All rights reserved.