In addition to address and collection-based filtering, further filtering can be done using a direct equal comparison of values, values that fit in a specified range or even a direct text search.
Filter Types
Equal
The name property is used to target the correct item to filter. The equal filter must take a string property as the value, even if the targeted property is a number.
The name property is used to target the correct item to filter. The range filter will take an array of up to two numbers, with the first number being the minimum value and the second number being the maximum value with both numbers being included.
The search filter simply takes a string value to search across all the properties and attributes in the metadata.
"search": "Freedom"
Filter Targeting
In the above examples you may have noticed the use of the . to target specific items. Since we separate properties and attributes (commonly known as traits in NFT metadata) we need to target them specifically in our filters.
By traits (aliased as attributes)
Filter through the attributes
e.g. attributes.Fur Colour, attributes.Age
By properties
Filter through properties on the metadata
e.g. properties.name
An example of a filter expression will look like the following for the above trait and property filters when put together: