//+------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1993. // // File: QueryS.idl // // Contents: Pickle-able structures used in IQuery, et. al. // // History: 29-Mar-93 KyleP Created // //-------------------------------------------------------------------------- [ uuid(E3971E54-4D6E-101A-971D-08002B2ECDA9), pointer_default(unique) ] interface IQueryStructures { // // Property set for dynamic query properties // // NOTE: PSGUID_QUERY is now defined in oledb.h as const GUID cpp_quote("#define DBQUERYGUID { 0x49691C90, \\") cpp_quote(" 0x7E17, 0x101A, \\") cpp_quote(" 0xA9, 0x1C, 0x08, 0x00, 0x2B, \\") cpp_quote(" 0x2E, 0xCD, 0xA9 } ") const DISPID DISPID_QUERY_RANKVECTOR = 2; const DISPID DISPID_QUERY_RANK = 3; const DISPID DISPID_QUERY_HITCOUNT = 4; const DISPID DISPID_QUERY_WORKID = 5; const DISPID DISPID_QUERY_ALL = 6; const DISPID DISPID_QUERY_UNFILTERED = 7; const DISPID DISPID_QUERY_REVNAME = 8; const DISPID DISPID_QUERY_VIRTUALPATH = 9; const DISPID DISPID_QUERY_LASTSEENTIME = 10; // // NOTE: The number of query properties includes the seven above, // plus 28 OLE-DB column IDs for pseudo-columns, plus eight // OLE-DB bookmark columns (41 total). In addition, dispids // always start at 2, a fact which is not taken into account in // the mapping macros. Reserve a few more to // allow for growth in the set of special columns. // const ULONG CQUERYDISPIDS = 11; cpp_quote("#define PSGUID_QUERY_METADATA { 0x624C9360, \\") cpp_quote(" 0x93D0, 0x11CF, \\") cpp_quote(" 0xA7, 0x87, 0x00, 0x00, 0x4C, \\") cpp_quote(" 0x75, 0x27, 0x52 } ") const DISPID DISPID_QUERY_METADATA_VROOTUSED = 2; const DISPID DISPID_QUERY_METADATA_VROOTAUTOMATIC = 3; const DISPID DISPID_QUERY_METADATA_VROOTMANUAL = 4; const DISPID DISPID_QUERY_METADATA_PROPGUID = 5; const DISPID DISPID_QUERY_METADATA_PROPDISPID = 6; const DISPID DISPID_QUERY_METADATA_PROPNAME = 7; const DISPID DISPID_QUERY_METADATA_STORELEVEL = 8; const DISPID DISPID_QUERY_METADATA_PROPMODIFIABLE = 9; const ULONG CQUERYMETADISPIDS = 10; // // Property set for OLE-DB bookmark properties // // BUGBUG - this may someday be defined in oledb.h. see ole-db spec bug #1271 cpp_quote("#define DBBMKGUID { 0xC8B52232L, \\") cpp_quote(" 0x5CF3, 0x11CE, \\") cpp_quote(" {0xAD, 0xE5, 0x00, 0xAA, 0x00, \\") cpp_quote(" 0x44, 0x77, 0x3D } }") const DISPID PROPID_DBBMK_BOOKMARK = 2; const DISPID PROPID_DBBMK_CHAPTER = 3; const ULONG CDBBMKDISPIDS = 8; // BUGBUG - this may someday be defined in oledb.h. see ole-db spec bug #1271 cpp_quote("#define DBSELFGUID {0xc8b52231,0x5cf3,0x11ce,{0xad,0xe5,0x00,0xaa,0x00,0x44,0x77,0x3d}}") const DISPID PROPID_DBSELF_SELF = 2; const ULONG CDBSELFDISPIDS = 8; const ULONG CDBCOLDISPIDS = 28; // NOTE: CQUERYPROPERTY must be < sum of: // CQUERYDISPIDS + CBQUERYMETADISPIDS + CDBBMKDISPIDS + CDBCOLDISPIDS + CDBSELFDISPIDS // Warning: Changing this number can change the ondisk format of OFS and CI const ULONG CQUERYPROPERTY = 64; cpp_quote("#define PSGUID_CHARACTERIZATION { 0x560c36c0, \\") cpp_quote(" 0x503a, 0x11cf, \\") cpp_quote(" 0xba, 0xa1, 0x00, 0x00, \\") cpp_quote(" 0x4c, 0x75, 0x2a, 0x9a } ") // // Query flags // const ULONG QUERY_VALIDBITS = 3; // // Restriction structures // const ULONG RTNone = 0; const ULONG RTAnd = 1; const ULONG RTOr = 2; const ULONG RTNot = 3; const ULONG RTContent = 4; const ULONG RTProperty = 5; const ULONG RTProximity = 6; const ULONG RTVector = 7; const ULONG RTNatLanguage = 8; typedef struct tagRESTRICTION RESTRICTION; // // Negation (NOT) Restriction // typedef struct tagNOTRESTRICTION { RESTRICTION * pRes; } NOTRESTRICTION; // // Node (AND/OR/PROXIMITY) Restriction // typedef struct tagNODERESTRICTION { ULONG cRes; [ size_is(cRes) ] RESTRICTION ** paRes; ULONG reserved; } NODERESTRICTION; // // Vector Restriction // // The vector restriction is similar to the OR restriction except // that each branch of the vector can be individually weighted and // a vector of ranks can be returned (the .RankVector property) // where each element of the vector is the rank of the corresponding // child restriction in the rank vector. // // Vector weights can have values between 0 and MAX_QUERY_RANK (currently // 1000). They are effectively the numerator of a fraction. MAX_QUERY_RANK // is the denominator. // // Note that no query optimization/reorganization is performed below // this level. // // The rank of a vector restriction may be computed in one of // several ways. These are: // // // MAX[ wi * ( MaxRank - ri ) ] // VECTOR_RANK_MIN MaxRank - --------------------------------- // MAX[wi] // // MAX[ wi * ri ] // VECTOR_RANK_MAX ----------------- // MAX[wi] // // n // SUM ri * wi // i=1 // VECTOR_RANK_INNER ------------- // n // SUM wi // i=1 // // n // 2 * SUM ri * wi // i=1 // VECTOR_RANK_DICE -------------------- // n 2 n 2 // SUM ri + SUM wi // i=1 i=1 // // n // SUM ri * wi // i=1 // VECTOR_RANK_JACCARD --------------------------------- // n 2 n 2 n // SUM ri + SUM wi - SUM ri * wi // i=1 i=1 i=1 // // // * wi = Weight of term i, ri = rank of term i in a given document // const ULONG VECTOR_RANK_MIN = 0; const ULONG VECTOR_RANK_MAX = 1; const ULONG VECTOR_RANK_INNER = 2; const ULONG VECTOR_RANK_DICE = 3; const ULONG VECTOR_RANK_JACCARD = 4; typedef struct tagVECTORRESTRICTION { NODERESTRICTION Node; ULONG RankMethod; } VECTORRESTRICTION; // // Content Restriction // const ULONG GENERATE_METHOD_EXACT = 0; const ULONG GENERATE_METHOD_PREFIXMATCH = 1; const ULONG GENERATE_METHOD_STEMMED = 2; typedef struct tagCONTENTRESTRICTION { FULLPROPSPEC prop; // Property [string] WCHAR * pwcsPhrase; // Content to search for LCID lcid; // locale ULONG ulGenerateMethod; // Generate method. } CONTENTRESTRICTION; // // Natural Language Restriction // typedef struct tagNATLANGUAGERESTRICTION { FULLPROPSPEC prop; // Property [string] WCHAR * pwcsPhrase; // Content to search for LCID lcid; // locale } NATLANGUAGERESTRICTION; // // Property Restriction // const ULONG PRLT = 0; // < const ULONG PRLE = 1; // <= const ULONG PRGT = 2; // > const ULONG PRGE = 3; // >= const ULONG PREQ = 4; // == const ULONG PRNE = 5; // != const ULONG PRRE = 6; // LIKE (Regular expression) const ULONG PRAllBits = 7; // (VAL & MASK) == MASK const ULONG PRSomeBits = 8; // (VAL & MASK) != 0 const ULONG PRAll = 0x100; // all elements of vector const ULONG PRAny = 0x200; // any elements of vector typedef struct tagPROPERTYRESTRICTION { ULONG rel; // Relation FULLPROPSPEC prop; // Property PROPVARIANT prval; // Constant value } PROPERTYRESTRICTION; // // Base Restriction // union _URes; struct tagRESTRICTION { ULONG rt; // Restriction Type ULONG weight; // Query Weight [ switch_type(ULONG), switch_is(rt) ] union _URes { [ case(RTAnd) ] NODERESTRICTION ar; [ case(RTOr) ] NODERESTRICTION or; [ case(RTProximity) ] NODERESTRICTION pxr; [ case(RTVector) ] VECTORRESTRICTION vr; [ case(RTNot) ] NOTRESTRICTION nr; [ case(RTContent) ] CONTENTRESTRICTION cr; [ case(RTNatLanguage) ] NATLANGUAGERESTRICTION nlr; [ case(RTProperty) ] PROPERTYRESTRICTION pr; [ default ] ; } res; }; // // Column descriptors. // // Each column represents a single property. A property is defined by // a UUID for the property set and either a index (DISPID) or name // to locate the property within the property set. // // typedef struct tagCOLUMNSET { ULONG cCol; [size_is(cCol)] FULLPROPSPEC * aCol; } COLUMNSET; // // Sort descriptors // // A sort is over a [sub] set of columns specified as return columns in // the query. // // BUGBUG - this should go away and be replaced by DBSORTKEY. // const ULONG QUERY_SORTASCEND = 0; const ULONG QUERY_SORTDESCEND = 1; const ULONG QUERY_SORTXASCEND = 2; const ULONG QUERY_SORTXDESCEND = 3; const ULONG QUERY_SORTDEFAULT = 4; typedef struct tagSORTKEY { FULLPROPSPEC propColumn; ULONG dwOrder; // Ascending/Descending LCID locale; // } SORTKEY; typedef struct tagSORTSET { ULONG cCol; // Number of sort columns [size_is(cCol)] SORTKEY * aCol; } SORTSET; // // Categorization descriptor // // Defines categorization of table. In IQuery this is just used as a // hint, indicating this categorization is likely to be used. The // column used for categorization is always the first uncategorized // sort column, except when clustering is used. // // // Unique categorization. Each unique value forms a category. // const ULONG CATEGORIZE_UNIQUE = 0; // // Cluster categorization. Use Inference clustering. Number of // clusters specified on entry. // const ULONG CATEGORIZE_CLUSTER = 1; // // Bucket categorization. Number of buckets and distribution of values // into buckets is defined. // const ULONG CATEGORIZE_BUCKETS = 2; const ULONG BUCKET_LINEAR = 0; const ULONG BUCKET_EXPONENTIAL = 1; typedef struct tagBUCKETCATEGORIZE { ULONG cBuckets; ULONG Distribution; } BUCKETCATEGORIZE; // // Range categorization. Ranges are explicitly specified. // The first range is from to aRangeBegin[0] - <1 unit>. // Next from aRangeBegin[0] to aRangeBegin[1] - <1 unit>, etc. // The last range is from aRangeBegin[cRange-1] to . // There will be a total of cRange + 1 ranges. // const ULONG CATEGORIZE_RANGE = 3; typedef struct tagRANGECATEGORIZE { ULONG cRange; [size_is(cRange)] PROPVARIANT * aRangeBegin; } RANGECATEGORIZE; typedef struct tagCATEGORIZATION { ULONG ulCatType; [ switch_type(ULONG), switch_is( ulCatType ) ] union { [ case(CATEGORIZE_CLUSTER) ] ULONG cClusters; [ case(CATEGORIZE_BUCKETS) ] BUCKETCATEGORIZE bucket; [ case(CATEGORIZE_RANGE) ] RANGECATEGORIZE range; [ case(CATEGORIZE_UNIQUE) ] ; }; COLUMNSET csColumns; // columns that can be bound to for categorization } CATEGORIZATION; typedef struct tagCATEGORIZATIONSET { ULONG cCat; // Number of categorizations [size_is(cCat)] CATEGORIZATION * aCat; } CATEGORIZATIONSET; // Some other stuff, moved here from winnot.h [mikese] typedef unsigned long OCCURRENCE; const OCCURRENCE OCC_INVALID = 0xFFFFFFFF; // Invalid Occurrence const LONG MAX_QUERY_RANK = 1000; // Maximum Rank / Weight }