CommonSearchOptions Class
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
An abstract class. Provides properties that customize the catalog search results when performing searches on one or more catalogs.
Namespace: Microsoft.CommerceServer.Catalog
Assembly: Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)
Syntax
'Declaration
Public MustInherit Class CommonSearchOptions
'Usage
Dim instance As CommonSearchOptions
public abstract class CommonSearchOptions
public ref class CommonSearchOptions abstract
public abstract class CommonSearchOptions
Remarks
You can use the properties in this class to customize catalog search results. To accomplish a search with the SearchOptions as the filter criteria, create an instance of this class, set the appropriate properties and pass the instance as a parameter to the Search method.
The following classes derive from this class:
CatalogSearchOptions - Provides properties to customize the catalog search results when performing searches on one or more catalogs.
SearchOptions - Provides properties to customize search results.
Examples
internal CatalogItemsDataSet SearchCatalog(string catalogName)
{
CatalogSearchOptions searchOptions = new CatalogSearchOptions();
searchOptions.PropertiesToReturn = "CategoryName, DefinitionName, i_classtype, ProductId, VariantId, DisplayName";
searchOptions.SetPaging(1, 20);
searchOptions.SortProperty = "CategoryName";
CatalogSearch catalogSearch = this.catalogContext.GetCatalogSearch();
catalogSearch.CatalogNames = catalogName;// This is a comma separated list of catalogs to search eg "Catalog1,catalog2"
catalogSearch.SqlWhereClause = "cy_list_price<10";// Return all items with price less than 10
catalogSearch.UseAdvancedFreetextSearch = true;//
catalogSearch.AdvancedFreeTextSearchPhrase = "\"sql books\""; // Returns all rows which contain the phrase "sql books"
/*
* Inventory Integration: Set the inventory options here
catalogSearch.InventoryOptions = new InventoryOptions();
catalogSearch.InventoryOptions.FilterOutOfStockSkus = true; // Do not return products which are out of stock
*/
/* To restrict searches to a single category
catalogSearch.CategoryName = "categoryname";
catalogSearch.Recursive = true;
*/
int totalRecords = 0;
CatalogItemsDataSet catalogItems = catalogSearch.Search(out totalRecords);
Console.WriteLine(totalRecords);
foreach (CatalogItemsDataSet.CatalogItem catalogItem in catalogItems.CatalogItems)
{
Console.WriteLine(catalogItem.CategoryName);
Console.WriteLine(catalogItem.DisplayName);
}
return catalogItems;
}
Inheritance Hierarchy
System..::.Object
Microsoft.CommerceServer.Catalog..::.CommonSearchOptions
Microsoft.CommerceServer.Catalog..::.CatalogSearchOptions
Microsoft.CommerceServer.Catalog..::.SearchOptions
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.