Filter Set by series name not working as expected?
Opened this issue · 6 comments
When running a query on cards.
Set.where(series='name:Scarlet & Violet')
-returns no results-, EDIT: It actuall returns all results i meant
I would expect a list of all the sets where the set.series.name == "Scarlet & Violet"
Yeah. my bad, i did mean it returns the wrong results instead of Scarlet and Violet Sets.
I do see it defaults to All, but i don't see why it doesn't work on that filter.
If i do sets = Set.where(q="series:Scarlet &Violet")
I get a str error pokemontcgsdk.restclient.PokemonTcgException: <exception str() failed>
if i do sets = Set.where(series="Scarlet & Violet")
it gives me all the sets again
if i curl the command https://api.pokemontcg.io/v2/sets?q=series:Scarlet&Violet
I get the correct data.
Yeah. my bad, i did mean it returns the wrong results instead of Scarlet and Violet Sets.
I do see it defaults to All, but i don't see why it doesn't work on that filter.
Hey no worries. I wanted to add my attempt at running it in case it might help you zero in on your issue. I understand what you meant now.
Cheers ✌️
It looks like the query Set.where(series='name:Scarlet & Violet') is returning all results instead of filtering correctly. Here are a few suggestions to fix this:
Check Query Syntax: Try using Set.where(series='Scarlet & Violet') without the name: prefix, as it might not be necessary depending on your framework.
Verify Data Structure: Ensure that the series attribute contains the exact value "Scarlet & Violet" by running a query to fetch unique series names:
Set.select('series').distinct()
Check Query Syntax: Try using Set.where(series='Scarlet & Violet') without the name: prefix, as it might not be necessary depending on your framework.
I'm not OP but for the sake of testing this suggestion, I got the whole list again, then I went ahead and looped through this result printing the set.series field to ensure that within this result there are in fact those with the series: Scarlet & Violet. I'll truncate the output to save space on this board.
OP, have you tried it with other series? Or even other series that have an '&' in them?
sets = Set.where(series='Scarlet & Violet')
for set in sets:
print(set.series)
.
.
.
Sword & Shield
Sword & Shield
Other
Other
EX
Sword & Shield
Sword & Shield
Sword & Shield
Sword & Shield
Sword & Shield
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet
Scarlet & Violet