More in Learn

Input Arguments

The input arguments that can be used when querying the Search API are discussed in this section.

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

Search Arguments

Any query made using the Search API requires arguments. These include language, after, before, first, orderBy, and filter.

Language

In Crystallize, you can translate any of the items (documents, folders or products). Using the language argument, you can search for items in a particular language. For example, the query below searches for items that are in Spanish.

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

After

The after argument in the query is the cursor and is used when you want to paginate search results. The argument takes a string value, which is a base64-encoded version of the offset. In the following query, we’re getting the items after the second item by giving the after argument a value of "MQ==" (base64-encoded version of 1).

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

You can use the cursor field to get the cursor value for each item. To learn more about this argument as well as pagination, head to the pagination section.

Before

This argument does the opposite of what the after argument does. It gets the values that are before the specified offset value provided to the argument. In the query below, we are getting all the items that exist before the third item by giving the argument a value of "Mg==" (base64-encoded version of 2).

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

First

This argument allows you to fetch only the amount of items you specify. Let's say you only want to grab the first three items from the search results. This is how you would do it:

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

orderBy

To order the search results, you can use the orderBy argument. You’ll need to specify the field name and the order direction within this argument. In the following query, we are ordering by name and the direction is set to ascending.

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

Filter

The search results can be filtered using the filter argument. The items can be filtered using any of the following: search term, type, variants, etc. The query below filters items using the search term 'plant'.

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