Export (0) Print
Expand All

IConditionGenerator::GenerateForLeaf method

Generates a special query expression for what would otherwise become a leaf query expression.

Syntax


HRESULT GenerateForLeaf(
  [in]           IConditionFactory *pConditionFactory,
  [in, unique]   LPCWSTR pszPropertyName,
  [in]           CONDITION_OPERATION op,
  [in, unique]   LPCWSTR pszValueType,
  [in]           LPCWSTR pszValue,
  [in, unique]   LPCWSTR pszValue2,
  [in]           IRichChunk *pPropertyNameTerm,
  [in]           IRichChunk *pOperationTerm,
  [in]           IRichChunk *pValueTerm,
  [in]           BOOL automaticWildcard,
  [out]          BOOL *pNoStringQuery,
  [out, retval]  ICondition **ppQueryExpression
);

Parameters

pConditionFactory [in]

Type: IConditionFactory*

An IConditionFactory object that can be used to create the necessary nodes.

pszPropertyName [in]

Type: LPCWSTR

Property name, or NULL if there is no property name.

op [in]

Type: CONDITION_OPERATION

A CONDITION_OPERATION enumerated type identifying the operation.

pszValueType [in]

Type: LPCWSTR

Semantic type describing the values in pszValue and pszValue2.

pszValue [in]

Type: LPCWSTR

A string generated by IConditionGenerator::RecognizeNamedEntities that represents the value. If pszValue2 is not NULL, then this represents the beginning of the value's range.

pszValue2 [in]

Type: LPCWSTR

If not NULL, a string generated by IConditionGenerator::RecognizeNamedEntities that represents the end of the value's range. If NULL, then pszValue represents a discrete value.

pPropertyNameTerm [in]

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the property name.

pOperationTerm [in]

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the operation.

pValueTerm [in]

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the value.

automaticWildcard [in]

Type: BOOL

TRUE if the generated condition should return results that begin with the specified value, if meaningful. FALSE if the generated condition should return results matching the specified value exactly.

pNoStringQuery [out]

Type: BOOL*

VARIANT_TRUE if the condition tree in ppQueryExpression should be the full query, or VARIANT_FALSE if the full query should be a disjunction of the condition tree in ppQueryExpression and the condition tree that would have been used if this method had returned S_FALSE.

ppQueryExpression [out, retval]

Type: ICondition**

Receives a pointer to an ICondition condition tree.

Return value

Type: HRESULT

Returns one of the following, or an error value otherwise.

Return codeDescription
S_OK

Successfully generated a condition.

S_FALSE

A condition was not generated, and the query parser must produce one in some other way.

 

Remarks

If this method returns S_FALSE, the calling query parser should generate a leaf node N with this property name, operation, and value. If this method returns S_FALSE and pNoStringQuery contains VARIANT_FALSE, the full generated query is a disjunction (OR) with the leaf node N and the condition tree in ppQueryExpression as subconditions.

If this method returns S_OK and pNoStringQuery contains VARIANT_TRUE, the condition tree in ppQueryExpression is the full query.

The value of pszValue2 is non-NULL only for a range query, such as date:1/2/2003..1/30/2006, where pszValue contains the value for 1/2/2003 and pszValue2 contains the value for 1/30/2006. A condition generator can elect to refuse ranges by always returning S_OK when pszValue2 is not NULL.

A condition generator can safely ignore the arguments pPropertyNameTerm, pOperationTerm, and pValueTerm. However, it would use them to produce a leaf node that has correct information about the origins in the query string of the property name, the operator, and the value, by passing them on to MakeLeaf.

In many cases, a condition generator can ignore the argument automaticWildcard because it would not apply. However, if the generated condition tree does some form of string search, where both a prefix search (COP_VALUE_STARTSWITH from CONDITION_OPERATION) and a search for the exact string (COP_EQUAL from CONDITION_OPERATION) are meaningful, then the former should be generated when automaticWildcard is VARIANT_TRUE, and the latter when automaticWildcard is VARIANT_FALSE.

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Header

Structuredquery.h

IDL

Structuredquery.idl

See also

Reference
IConditionGenerator
IConditionFactory
CONDITION_TYPE
CONDITION_OPERATION
CONDITION_CREATION_OPTIONS
ICondition
ICondition2

 

 

Community Additions

ADD
Show:
© 2014 Microsoft