Skip to main content
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 and search an item by a search term, type, etc.

Filter using Search Term

To filter the search results using a specific search term, the searchTerm field is used. It takes in 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'.

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.

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.

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.

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.

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.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community