4.2 Example 2

In the previous example, the query was quite simple. Now consider a slightly more complex query, assuming that the user wants to retrieve the size of the documents that contain the following words: "Microsoft" and "Office". This is specified in the following steps.

Change the Restriction field contained in the CPMCreateQueryIn message sent in step 5 (example 1) as follows:

  • The Restriction field is of type CRestriction and is set as follows:

    _ulType is set to 0x00000001 (RTAnd).

    _weight is set to 0x00000000.

    The rest of the field contains a CNodeRestriction structure:

    • _cNode is set to 0x00000002, indicating that there are two nodes in the paNode array.

  • The _paNode field is an array of two CRestriction structures.

    _paNode[0] contains the following:

    • _ulType is set to 0x00000004 (RTContent).

    • _weight is set to 0x00000000.

    • The rest of the field contains a CContentRestriction structure:

      • _Property is set to GUID b725f130-47ef-101a-a5f1-02608c9eebac / 0x00000001 (for PRSPEC_PROPID) / 0x13.

      • _Cc is set to 0x00000009.

      • _pwcsphrase is set to the string "Microsoft".

      • _lcid is set to 0x409 (for English).

      • _ulGenerateMethod is set to 0x00000000 (exact match).

        _paNode[1] I contains the following:

    • _ulType is set to 0x00000004 (RTContent).

    • _weight is set to 0x00000000.

    • The rest of the field contains a CContentRestriction structure:

      • _Property is set to GUID b725f130-47ef-101a-a5f1-02608c9eebac / 0x00000001 (for PRSPEC_PROPID) / 0x13.

      • _Cc is set to 0x00000006.

      • _pwcsphrase is set to the string "Windows".

      • _lcid is set to 0x409 (for English).

      • _ulGenerateMethod is set to 0x00000000 (exact match).