cardano-graphql icon indicating copy to clipboard operation
cardano-graphql copied to clipboard

Where for partially matching string

Open xray-robot opened this issue 3 years ago • 2 comments

Is there any way to query for a partially matched string? Maybe the parameter "_like".

query assets {
  assets(
    limit: 20
    offset: 0
    where: { assetName: { _in: "5370616365" } }
  ) {
    assetId
    assetName
  }
}

5370616365 is "Space" in hex, so I want to find all SpaceBudz assets for example.

xray-robot avatar Aug 10 '21 07:08 xray-robot

There are _like and _ilike operators, but they are unfortunately not available for bytea data type. I think it is worth decoding the assetName at the point of discovering the asset on chain, and storing it alongside as text to facilitate this.

https://hasura.io/blog/full-text-search-with-hasura-graphql-api-postgres/

rhyslbw avatar Aug 13 '21 02:08 rhyslbw

There are _like and _ilike operators, but they are unfortunately not available for bytea data type. I think it is worth decoding the assetName at the point of discovering the asset on chain, and storing it alongside as text to facilitate this.

https://hasura.io/blog/full-text-search-with-hasura-graphql-api-postgres/

If possible, it would be great to make searches with case insensitive queries. We have created an NFT explorer and it is very important to avoid search problems in this case - https://minterr.io/explorer/?name=space

Thank you!

xray-robot avatar Aug 13 '21 16:08 xray-robot