ICatalogManager::FreeTextSearch

Ee811779.c++_off(en-US,CS.10).gifEe811779.vb_on(en-US,CS.10).gif

Use this method to perform a free-text search of catalogs.

Definition

HRESULT ICatalogManager::FreeTextSearch(BSTRstrPhrase,VARIANTstrCatalogsToSearch,VARIANTeClassTypeRequired,VARIANTstrPropertiesToReturn,VARIANTstrPropertyToSortOn,VARIANT_BOOLfSortAscending,VARIANTlStartingRecord,VARIANTlRecordsToRetrieve,VARIANT*plTotalRecordsInQuery,_Recordset**ppRSResult);

Parameters

strPhrase

[in] A BSTR that contains the search phrase.

strCatalogsToSearch

[in, optional] A VARIANT that contains the catalogs to search in a comma-separated list. An empty string indicates search all catalogs.

eClassTypeRequired

[in, optional] A VARIANT that contains the catalog class desired. Valid values are from the CatalogClassTypeEnum enumeration, and are described in the Remarks section below.

strPropertiesToReturn

[in, optional] A VARIANT that contains the properties to return. This is a comma delimited String.

strPropertyToSortOn

[in, optional] VARIANT that contains the property on which to sort. If not included, the returned recordset will be unsorted.

fSortAscending

[in, defaultvalue (-1)] A VARIANT_BOOL that specifies whether to sort in ascending or descending order. A value of True indicates that the returned recordset will be sorted in ascending order. A value of False indicates that the returned recordset will be sorted in descending order.

lStartingRecord

[in, optional] A VARIANT that contains the number of the starting record to retrieve. This is an offset from the first record.

lRecordsToRetrieve

[in, optional] A VARIANT that contains the number of records to retrieve starting from the starting record.

plTotalRecordsInQuery

[out, optional] A pointer to a VARIANT used to return the number of records returned in the search.

ppRSResult

[out, retval] A pointer to a _Recordset object that will be used to return the query results.

Return Values

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_MULTI_CAT_QUERY_NEEDS_PROPS 0x8898000F The strPropertiesToReturn parameter must be specified if the search is done across multiple catalogs.
E_CAT_NO_CATALOGS 0x88980013 There were no catalogs in the Product Catalog System.

Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

Remarks

The plTotalRecordsInQuery and ppRSResult parameters contain valid data only if the method completes successfully.

The FreeTextSearch method is used to perform arbitrary lexical comparisons on words or phrases in one or more catalogs. The FreeTextSearch functionality in the Product Catalog System is based on full text indexing in SQL Server 2000, and therefore, inherits keywords and operators from SQL Server 2000 for controlling the free text search.

The following table shows the values of the CatalogClassTypeEnum enumeration, their associated names, and describes their use.

Name Value Description
cscCategoryClass 1 Requests category data.
cscProductVariantClass 2 Requests product variant data.
cscProductClass 4 Requests product data.
cscProductFamilyClass 8 Requests product family data.
cscProductFamilyForVariantsClass 16 Requests family for variant data, which means the product family of a product variant is being requested.
CscProductVariantsForFamily 32 Requests variants for family data, which means that all of the product variants for a product family are being requested.

CatalogClassTypeEnum values can be combined in the eClassTypeRequired parameter with logical OR operators, so that specifying cscProductClass OR cscProductVariantClass will return both product and product variant data.

The programming rules regarding the strPropertiesToReturn parameter vary depending on whether a single catalog name is passed in the strCatalogsToSearch parameter or whether multiple catalog names are passed. When a single catalog name is passed, the strPropertiesToReturn parameter is optional and defaults to all properties. When multiple catalog names are passed, the strPropertiesToReturn parameter is required.

If no value is specified for the strPropertiesToReturn parameter the method returns all fields in the specified catalog, otherwise it returns only the fields specified in the strPropertiesToReturn parameter.

For more information, see CatalogProduct Recordset.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

See Also

CatalogManager Object

ICatalogManager::Query


All rights reserved.