CITextToFullTree

[This is preliminary documentation and subject to change.]

CITextToFullTree creates a complete DBCOMMANDTREE from a query string, output columns, sort columns, and a set of custom properties.

STDAPI CITextToFullTree(
  WCHAR const * pwszRestriction,
  WCHAR const * pwszColumns,
  WCHAR const * pwszSortColumns,
  WCHAR const * pwszReserved,
  DBCOMMANDTREE * * ppTree,
  ULONG cProperties,
  CIPROPERTYDEF * pProperties,
  LCID LocaleID
);
 

Parameters

pwszRestriction
[in] Points to a null-terminated string that specifies an Index Server query. The syntax for queries is described in the Index Server documentation.
pwszColumns
[in] Points to a null-terminated string that specifies a comma separated list of column names that are returned in the query results. These columns can be bound by OLE DB accessors.
pwszSortColumns
[in] Points to a null-terminated string that contains a comma separated list of column names that specify the sort order for the query results. A sort direction can be appended to each column name. Use [d] for descending, and [a] for ascending. If no sort order is specified, ascending is the default. Can be 0 for no sort order.
pwszReserved
[in] Must be 0.
ppTree
[out] Address of output variable that receives the command tree built by the function.
cProperties
[in] Count of properties in the pProperties array, or 0 if pProperties is 0.
pProperties
[in] Address of an array of properties that can be referred to by friendly name in pwszRestriction. Column names in the wcsFriendlyName field of each CIPROPERTYDEF must be specified in uppercase. Can be 0 if no properties are being defined and cProperties is 0. Index Server's built-in properties do not need to be defined to be used. It is an error to define a property with the same friendly name as a built-in property.
LocaleID
[in] The locale ID used for nodes in ppTree that contain an LCID field, including content restrictions, sort order, and others.

Return Values

An HRESULT, S_OK if successful.

Remarks

The query tree allocated by CITextToSelectTree must be freed either with ICommandTree::FreeCommandTree or passed to ICommandTree::SetCommandTree with the fCopy parameter set to FALSE.

Example

This sample code creates a command tree. The list of properties returned by the query include myproperty, path, and size. The sort order is first by rank descending, then by path ascending. The default system locale is used to create the command tree.

CIPROPERTYDEF aProperties[1];
const GUID guidOffice = { 0xd5cdd505, 0x2e9c, 0x101b,
                          0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae }
                            };
aProperties[0].wcsFriendlyName = L"ISSUENUMBER";
aProperties[0].dbType = DBTYPE_R8;
aProperties[0].dbCol.uGuid.guid = guidOffice;
aProperties[0].dbCol.eKind = DBKIND_GUID_NAME;
aProperties[0].dbCol.pwszName.ulPropid = L"ISSUENUMBER";
DBCOMMANDTREE * pTree;
HRESULT hr = CiTextToFullTree( L"microsoft and @issuenumber=2",
                               L"size,path,issuenumber",
                               L"rank[d],path[a]",
                               &pTree,
                               1,
                               aProperties,
                               GetSystemDefaultLCID() );
if ( SUCCEEDED( hr ) )
{
    hr = pICommand->SetCommandTree( pTree,
                                    DBCOMMANDREUSE_NONE,
                                    FALSE );
    if ( SUCCEEDED( hr ) )
    {
        // ...
        // execute a query
        // ...
    }
}
 

This is the DBCOMMANDTREE pTree created by the example code:

DBCOMMANDTREE pTree Created by Example Code