[This is preliminary documentation and subject to change.]
CITextToSelectTree creates a DBCOMMANDTREE from an Index Server query language string. The command tree returned by this function can be used as the next sibling under a DBOP_table_name node. A DBOP_project node is also required to form a complete command tree.
STDAPI CITextToSelectTree(
WCHAR const * pwszRestriction,
DBCOMMANDTREE * * ppTree,
ULONG cProperties,
CIPROPERTYDEF * pProperties,
LCID LocaleID
);
An HRESULT, S_OK if successful.
Command trees created by CITextToSelectTree contain the select portion of a DBCOMMANDTREE. A tree returned by CITextToSelectTree can be combined with project and sort nodes to form a complete command tree. Use CITextToSelectTree instead of CITextToFullTree if the sort order and project columns tree nodes are already available.
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.
This example creates a DBCOMMANDTREE. A custom property from a Microsoft® Word document named "IssueNumber" of type "Number" is defined and used in the query.
DBCOMMANDTREE * pCompleteTree;
DBCOMMANDTREE * pTableNode;
// ...
// Insert code here to make pCompleteTree a complete tree using pTableNode
// as the DBOP_table_name node that has no query restriction (yet).
// User CoTaskMemAlloc to allocate memory for the nodes.
// ...
//
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 * pSelectTree;
HRESULT hr = CiTextToSelectTree( L"microsoft and @issuenumber=2",
&pSelectTree,
1,
aProperties,
GetSystemDefaultLCID() );
if ( SUCCEEDED( hr ) )
{
pTableNode->pctNextSibling = pSelectTree;
hr = pICommand->SetCommandTree( pCompleteTree,
DBCOMMANDREUSE_NONE,
FALSE );
if ( SUCCEEDED( hr ) )
{
// ...
// execute a query
// ...
}
}
This is the DBCOMMANDTREE pSelectTree created by the example code:
DBCOMMANDTREE pSelectTree Created by Example Code