Creating catalog searches

You can create catalog searches so that users can search for items in a catalog.

Before you begin

Before you can create a catalog search, the catalog must exist.

Procedure

Create the search. Use any one of the following methods: user interface, Java™ API, or script API.
Option Description
User interface - rich search simplified
  1. Click Product Manager > Catalogs > Catalog Console.
  2. Choose a catalog.
  3. Click Rich Search.
  4. Provide the necessary search details.
  5. Click Search.
Java API The following sample Java API code creates a catalog search, executes it and displays the results.
Context ctx = PIMContextFactory.getCurrentContext();
SearchQuery query = ctx.createSearchQuery(" select item.pk from catalog('my catalog') where item['myspec/myattribute'] = 'abc' ");
SearchResultSet rs = query.execute();
while (rs.next())
{
	System.out.println("Primary Key: " + rs.getString(1));
}
Script The following sample script creates a catalog search, executes it and displays the results.
var query = new SearchQuery(" select item.pk from catalog('my catalog') where item['myspec/myattribute'] = 'abc' ");
		var rs = query.execute();
		while (rs.next())
		{
			out.writeln("Primary Key: " + rs.getString(1));
		}
Query language The following code searches all the items in a catalog. The catalog is called Product with a primary spec called spec. This query returns all the items in the catalog.
select item from
catalog('Product')
The search is created, and users can now view it in the left pane.