Development discussions around Shopify APIs
I am playing around with new File API, and I would like to be able to get file by filename that is exactly as specified. Instead API is pulling also other assets that contains the key in their names, e.g. boardteam-1, boardteamblabla, etc.
in documentation says that about equality symbol ":" * equality depends on how a field is indexed. For numeric fields : represents equality. For tokenized fields, equality exists if the term is found anywhere in the field. For non-tokenized fields, the search query string must match the searched field exactly.
It seems that filename is a tokenized field then. Is there a way to get exact file by name?
My dummy query below:
{
files(first: 10, query: "filename:boardteam") {
edges {
node {
... on MediaImage {
image {
src
}
}
... on GenericFile {
url
}
}
}
}
Hi @TwoColors
Hope you're having a great day!
Did you try with the phrase query?
{
files(first: 10, query: "filename:'boardteam'") {
edges {
node {
... on MediaImage {
image {
src
}
}
... on GenericFile {
url
}
}
}
}
Yes I did, but that's the problem with it. It then finds all assets that contains "boardteam" anywhere in the filename. So potentially can return more assets than you want. Even more, the default sorting starts from longest file name, so you need to reverse results to get exact file on first place
User | RANK |
---|---|
8 | |
7 | |
3 | |
3 | |
3 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By