[SOLVED] Querying 'name' with two words on searchNFTs()

I’m not getting results when querying names that are more than 1 word using searchNFTs().

If you try it here: https://admin.moralis.io/web3apis#operations-token-searchNFTs

chain: 'polygon',
format: 'decimal',
q: 'Zee Cross', // this is the name
filter: 'name, attributes',
from_block: 27230262,
token_address: "0x67F4732266C7300cca593C814d46bee72e40659F",
limit: 30

This returns zero results when there should be 1.

If you change query to “Buterin” you get a bunch of results.

It seems like the space in the name messes up the query.

Also, if I change q=“Cross” and filter=“name” I get results from other NFT collections but I’ve stated token_address=“0x67F4732266C7300cca593C814d46bee72e40659F” so not sure why it’s giving me these other results.

1 Like

This seems to work for me and it has a space:

https://deep-index.moralis.io/api/v2/nft/search?chain=polygon&format=decimal&q=Shibuya%20Crossing&filter=name&from_block=27230262

Ya but I’m trying to search a specific token address and its giving me results from other addresses and Also not coming up with results for things I know should be there.

Is there any way to specify the attribute name you want to search a value for?

Something like attributes.trait_type === “color”

we will this soon that issue with token_address filter

we don’t support this search by attribute name from what I know, if that trait value could be found as a substring, maybe you can search for that substring

this works now:

https://deep-index.moralis.io/api/v2/nft/search?chain=polygon&format=decimal&q=Zee%20Three&filter=name&token_address=0x67F4732266C7300cca593C814d46bee72e40659F&limit=34

mainly the filter by token_address

2 Likes

Heads up for anyone else using this.

It seems like it now also requires the addresses parameter as well with the same contract address.

https://deep-index.moralis.io/api/v2/nft/search?chain=polygon&format=decimal&q=Zee%20Three&filter=name&addresses=0x67f4732266c7300cca593c814d46bee72e40659f&token_address=0x67f4732266c7300cca593c814d46bee72e40659f&limit=20