More in Learn

Search Filters

This section explains how the filter object works and how you can use it to define a number of applied fields to your query to search an item by a search term, type, etc.

In order to perform these operations, ensure that you have the proper authentication (if necessary) and user permissions.

Filter using Search Term

To filter the search results using a specific search term, the searchTerm field is used. It takes a string value, which is the term you would like to use to filter the results. Below, the query is getting all the results that are associated with the term 'plant'.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Filter by Type

An item in Crystallize can belong to one of the following types: product, document, or folder. The following query returns all the items that belong to the document type.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Include

The include field allows you to filter results via the following fields: id, variants, topics, paths, shapes, SKUs, etc. The query below fetches all the products within a specified path.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Exclude

The exclude field does the exact opposite, it excludes items. The example query below retrieves all the items in the plants folder, but excludes the product whose ID we have specified. You can specify multiple IDs within the array.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Product Variants

You can filter results based on whether it's a variant or not. Using the product variants field, you can also further filter the results belonging to a price range or filter these via attributes. The following query returns items that are not the default variants.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...

Price Variants

If you have multiple price variants, you can retrieve a specific variant by using the priceVariants field. All you need to do is specify the identifier.

Circle loading spinnerImage of a partial circle indicating &qoute;loading&qoute;.Fetching snippet...
People showing thumbs up

Need further help?

Join and ask our
slack community.

Join our slack community