Skip to content

Complex filtering logic in tokens() query? #70

Description

@rodrigoescandon

If I run the following query, I get all tokens with that match the attribute filter {traitType: "Eyes", value: "classic"} or {traitType: "Hat", value: "strawberry hat"}. Is there a way to filter using complicated logic? For example, a way to get tokens that match both attributes (intersection of sets rather than union)? I tried using the standard and, or, and not operators from GraphQL but couldn't figure out how to pass them to the tokens query.

  query Query {
    tokens(
      filter: {attributeFilters: [
        {traitType: "Eyes", value: "classic"},
      	{traitType: "Hat", value: "strawberry hat"}
      ]},
      where: {collectionAddresses: "0x5af0d9827e0c53e4799bb226655a1de152a425a5"},
      pagination: {limit: 12},
      sort: {sortKey: MINTED, sortDirection: ASC}
    ) {
      nodes {
        token {
          tokenId
          attributes {
            traitType
            value
          }
        }
      }
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions