Google Commerce Search Deployment Guide User Manual

Page 20

Advertising
background image

Specifying multiple values

Specifying multiple facets

Specifying multiple values

You can allow users to choose multiple values with an OR operator. This will return items with
either color=Red OR color=Green:

&restrictBy=color(text)=Red|Green

This is implemented when you allow users to check multiple values for a refinement.

Specifying multiple facets

Refinements are additive, so if you specify multiple restrictBy fields they will be ANDed.
This will return items with both color=Red AND color=Green:

&restrictBy=color(text)=Red,color(text)=Green

Typically this method is used when you allow users to select only one options per refinement.
Here someone might have selected size=small, then color=red and price under $20:

&restrictBy=size(text)=small,color(text)=red,price=[0,20]

Specifying ranges

Range-based restrictions can be specified for numeric values. As shown in the example above,
a price range restrict is specified as &restrictBy=price=[0,20)

The square brackets, [ or ], mean “inclusive,” while the parentheses, ( or ), mean “exclusive.”

price=[0,20)

matches everything from 0 up to 20, while price=(0,20] matches everything

greater than 0 up to and including 20.

Breadcrumbs
“Breadcrumbs” are a user interface feature that keeps track of what options a user has
selected, or levels of category navigation. Currently there are no features that explicitly provide
breadcrumbs in the Shopping API, but they can still be implemented.

To generate the breadcrumb list your code would look at either the actual URL for your search
page, or the “self” link in the results--both of which include all of the refinement parameters.
Simply iterate through the parameter list and create a breadcrumb link for each parameter.
When a user clicks on the breadcrumb, your code would remove that parameter and resubmit
the API request.

In this query string example we can see the user has clicked on size and color refinements:
?q=android shirt&size=Large&color=Black

So a breadcrumb display might look something like:

Home

/

android shirt

/

Large

/

Black

This could be enhanced to have checkboxes next to each option to allow for removing that
restriction.

20

Advertising