The annotated version of the routine rsFreeTextSearch, found in the include file catalog.asp, follows:
Function rsFreeTextSearch(ByVal sPhrase, _ ByVal iStartingRecord, _ ByVal iRecordsToRetrieve, _ ByRef iRecordCount) Dim sPropertiesToReturn, sPropertiesToSortOn, _ rsResult, iClassType, sCatalogsToSearch
The properties to be returned in the record set, and their sort order, are hardwired in the next two string assignments.
' "name" and "description" are required product ' properties and cannot have null values. sPropertiesToReturn = PRODUCT_NAME_PROPERTY_NAME & "," & _ PRODUCT_DESCRIPTION_PROPERTY_NAME & "," & _ CATALOG_NAME_PROPERTY_NAME & "," & _ CATEGORY_NAME_PROPERTY_NAME & "," & _ CATALOG_PRODUCTID_PROPERTY_NAME & "," & _ CATALOG_VARIANTID_PROPERTY_NAME & "," & _ DEFINITION_TYPE_PROPERTY_NAME ' "name" is a required product property and cannot have null value. sPropertiesToSortOn = CATEGORY_NAME_PROPERTY_NAME & "," & _ PRODUCT_NAME_PROPERTY_NAME
The values used in the following assignment are from the CatalogClassTypeEnum enumeration, which defines the enumeration values as powers of two so that they can be combined into a bit field.
' iClassType determines the type of entities to search. ' (See FreeTextSearch documentation) iClassType = cscProductFamilyForVariantsClass Or _ cscProductClass Or _ cscCategoryClass
The routine sUserCatalogsAsString is in the include file catalog.asp and returns a string that contains a comma-separated list of the catalogs associated with the current user.
sCatalogsToSearch = sUserCatalogsAsString()
The routine ends by calling the FreeTextSearch method of the global CatalogManager object, passing a combination of the parameters passed to this routine and the parameters initialized within the routine. The RecordSet object returned by the method FreeTextSearch returned by this routine to its caller.
Set rsFreeTextSearch = _ MSCSCatalogManager.FreeTextSearch(sPhrase, _ sCatalogsToSearch, _ iClassType, _ sPropertiesToReturn, _
Previous Next |