CatalogManager3.FreeTextSearch Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Function FreeTextSearch(strPhrase As String,
  Optional strCatalogsToSearch As Object,
  Optional eClassTypeRequired As Object,
  Optional strPropertiesToReturn As Object,
  Optional strPropertyToSortOn As Object,
  Optional fSortAscending As Boolean,
  Optional lStartingRecord As Object,
  Optional lRecordsToRetrieve As Object,
  ByRef Optional plTotalRecordsInQuery As Object) As _Recordset

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
using ADODB26Lib;                              //For _Recordset
…
public _Recordset FreeTextSearch(stringstrPhrase,
  objectstrCatalogsToSearch,
  objecteClassTypeRequired,
  objectstrPropertiesToReturn,
  objectstrPropertyToSortOn,
  boolfSortAscending,
  objectlStartingRecord,
  objectlRecordsToRetrieve,
  ref objectplTotalRecordsInQuery);

Parameters

[Visual Basic .NET]

  • strPhrase
    A String that contains the search phrase.
  • strCatalogsToSearch
    An Object that contains the catalogs to search in a comma-separated list. An empty string indicates search all catalogs.
  • eClassTypeRequired
    An Object that contains the catalog class desired. Valid values are from the CatalogClassTypeEnum enumeration, and are described in the Remarks section below.
  • strPropertiesToReturn
    An Object that contains the properties to return. This is a comma-delimited String.
  • strPropertyToSortOn
    An Object 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
    An Object that contains the number of the starting record to retrieve. This is an offset from the first record.
  • lRecordsToRetrieve
    An Object that contains the number of records to retrieve starting from the starting record.
  • plTotalRecordsInQuery
    An Object used to return the number of records returned in the search.

[C#]

  • strPhrase
    A string that contains the search phrase.
  • strCatalogsToSearch
    An object that contains the catalogs to search in a comma-separated list. An empty string indicates search all catalogs.
  • eClassTypeRequired
    An object that contains the catalog class desired. Valid values are from the CatalogClassTypeEnum enumeration, and are described in the Remarks section. Optionally, specify no catalog class by setting this to Type.Missing.
  • strPropertiesToReturn
    An object that contains the properties to return. This is a comma-delimited String. Optionally, if a single catalog is specified, specify all properties by setting this to Type.Missing.
  • strPropertyToSortOn
    An object that contains the property on which to sort. Specify Type.Missing to****return an unsorted Recordset.
  • fSortAscending
    A 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
    An object that contains the number of the starting record to retrieve. This is an offset from the first record. Specify Type.Missing to return all records.
  • lRecordsToRetrieve
    An object that contains the number of records to retrieve starting from the starting record. Specify Type.Missing to return all records.
  • plTotalRecordsInQuery
    An object used to return the number of records returned in the search.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns the _Recordset interface to a Recordset object that contains the search results.

[C#] This method returns the _Recordset interface to a Recordset object that will be used to return the query results.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The following table shows the custom COM errors that a COMException can wrap.

Name Value Description
E_CAT_CATMGR_NOT_INITIALIZED

[C#] 0x889800B

[Visual Basic .NET] &H8898005

The CatalogManager object has not been initialized. The CatalogManager object should be initialized before calling this method.
E_CAT_INVALID_RS_POINTER

[C#] 0x889800B

[Visual Basic .NET] &H8898007

The recordset pointer that you specified is invalid
E_INVALIDARG

[C#] 0x8007005

[Visual Basic .NET] &H8007007

One or more arguments are invalid
E_CAT_INVALID_RETURN_PROPS

[C#] 0x8898011

[Visual Basic .NET] &H889801D

The Properties to return that you specified are invalid. Properties that contain a space should be enclosed in square brackets. Properties should not contain [ or ] and /* or -- in property names.
E_CAT_INVALID_SORT_PROPS

[C#] 0x8898011

[Visual Basic .NET] &H889801E

The Properties to sort that you specified are invalid. Properties that contain a space should be enclosed in square brackets. Properties should not contain [ or ] and /* or -- in property names.
S_FALSE 1 Error. The recordset will be set to NULL.
E_CAT_MULTI_CAT_QUERY_NEEDS_PROPS

[C#] 0x8898000

[Visual Basic .NET] &H889800F

When performing a query against multiple Catalogs, you should specify the actual properties to return.

Remarks

The plTotalRecordsInQuery parameter and returned interface 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 Microsoft 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, and shows 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 enumeration 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.

[Visual Basic .NET]

Example

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

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

CatalogManager3 Class

CatalogManager3.Query

Copyright © 2005 Microsoft Corporation.
All rights reserved.