Drag to set position!
Sticky
excluding a tag
I want to exclude a tag, eg. - brisbane
but even using the API tools, when I include the tags, "garden,-brisbane"
on the page
www.flickr.com/services/api/flickr.photos.search.html
when adding a user ID, it still doesn't return what I am after, I get garden and brisbane, despite the documentation stating "You can exclude results that match a term by prepending it with a - character."
even using
$.getJSON("https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
ids : "39672088@N07,7519521@N06",
tags: "garden,-brisbane",
tagmode: "any",
format: "json",
},
function(data) {
$.each(data.items, function(i,item){
$("").attr("src", item.media.m).appendTo("#images");
if ( i == 10 ) return false;
});
});
where if I want to remove a single photo that is "brisbane", the - tag does not work.
but even using the API tools, when I include the tags, "garden,-brisbane"
on the page
www.flickr.com/services/api/flickr.photos.search.html
when adding a user ID, it still doesn't return what I am after, I get garden and brisbane, despite the documentation stating "You can exclude results that match a term by prepending it with a - character."
even using
$.getJSON("https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
ids : "39672088@N07,7519521@N06",
tags: "garden,-brisbane",
tagmode: "any",
format: "json",
},
function(data) {
$.each(data.items, function(i,item){
$("").attr("src", item.media.m).appendTo("#images");
if ( i == 10 ) return false;
});
});
where if I want to remove a single photo that is "brisbane", the - tag does not work.
myobis
7 years ago
Just a feeling : did you try with tag_mode='all' ?
indeed, with 'any', I understand your "garden,-brisbane" query as
pictures having "garden" or not having "brisbane".
indeed, with 'any', I understand your "garden,-brisbane" query as
pictures having "garden" or not having "brisbane".
yes, I tried that
doing that returns the one image I am trying to remove :-)
the - seems to be being ignored completely
doing that returns the one image I am trying to remove :-)
the - seems to be being ignored completely
myobis
Posted 7 years ago. Edited by myobis (member) 7 years ago
I did a few tests which confirm what you say..
I could not make the "excluding this tag" feature work..
This query works (with tag exclusion) but this is not the API.
www.flickr.com/search/?q=myobis+-spain&m=tags&ss=...
Remains for you the possibility to filter the unwanted results out of the flickr response (adding "&extras=tags" to your search query will return the photo tags).
I could not make the "excluding this tag" feature work..
This query works (with tag exclusion) but this is not the API.
www.flickr.com/search/?q=myobis+-spain&m=tags&ss=...
Remains for you the possibility to filter the unwanted results out of the flickr response (adding "&extras=tags" to your search query will return the photo tags).
(Cross-posting this from the mailing list, just in case anyone encounters the same problem and finds this thread)
There appears to be an (undocumented?) tag_mode value 'bool', which makes flickr.photos.search respect the '-' prefixing to exclude a tag, but otherwise behaves like the 'all' option.
This is also what the Organizr uses (and it supports tag negation).
There appears to be an (undocumented?) tag_mode value 'bool', which makes flickr.photos.search respect the '-' prefixing to exclude a tag, but otherwise behaves like the 'all' option.
This is also what the Organizr uses (and it supports tag negation).
you need at least one non-excluded tag, unfortunately, for tag exclusion to work.
Damn, this has just explained the problem I am having. I wonder why you can't exclude based on one tag?
Can anyone think of a workaround that would mean I could in effect return all images and then exclude those that match one value? I guess I'm going to have to do it by fetching all images and then excluding them programatically based on a match, but that doesn't feel like either an efficient use of the API, or of the code using it.
Can anyone think of a workaround that would mean I could in effect return all images and then exclude those that match one value? I guess I'm going to have to do it by fetching all images and then excluding them programatically based on a match, but that doesn't feel like either an efficient use of the API, or of the code using it.