CatalogManager.FreeTextSearch

Ee811778.c++_on(en-US,CS.10).gifEe811778.vb_off(en-US,CS.10).gif

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

Definition

Function FreeTextSearch(strPhrase As String,Optional strCatalogsToSearch As Variant,Optional eClassTypeRequired As Variant,Optional strPropertiesToReturn As Variant,Optional strPropertyToSortOn As Variant,Optional fSortAscending As Boolean,Optional lStartingRecord As Variant,Optional lRecordsToRetrieve As Variant,Optional plTotalRecordsInQuery As Variant) As _Recordset

Parameters

strPhrase

A String that contains the search phrase.

strCatalogsToSearch

A Variant that contains the catalogs to search in a comma-separated list. An empty string indicates search all catalogs.

eClassTypeRequired

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

strPropertiesToReturn

A Variant that contains the properties to return. This is a comma-delimited String.

strPropertyToSortOn

A Variant that contains the property on which to sort. If not included, the returned recordset will be unsorted.

fSortAscending

A Boolean 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. The default value is TRUE.

lStartingRecord

A Variant that contains the number of the starting record to retrieve. This is an offset from the first record.

lRecordsToRetrieve

A Variant that contains the number of records to retrieve starting from the starting record.

plTotalRecordsInQuery

A Variant used to return the number of records returned in the search.

Return Values

If this method completes successfully, it returns a Recordset object that contains the search results.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM 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 &H8898000F The strPropertiesToReturn parameter must be specified if the search is done across multiple catalogs.
E_CAT_NO_CATALOGS &H88980013 There were no catalogs in the Product Catalog System.

Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

The recordset returned by this method contains 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.

Example

'rsFTSResults is a recordset object
'plTotalRecordsInQuery is a Variant. 
'Check it after the method returns for the 
'total number of records that match the query.
Set rsFTSResults = myCatalogManager.FreeTextSearch("red ribbons", "Craft Supplies", "", "Price", True, 0, 20, plTotalRecordsInQuery)

See Also

CatalogManager Object

CatalogManager.Query


All rights reserved.