Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hasimage not working properly #9

Open
ashkan90 opened this issue Jan 18, 2019 · 8 comments
Open

hasimage not working properly #9

ashkan90 opened this issue Jan 18, 2019 · 8 comments

Comments

@ashkan90
Copy link

https://api.harvardartmuseums.org/object&hasimage=1&gallery=1320

then it's returning a lot data but all data don't have image
"images": [],
"primaryimageurl": null,

that's not what i excepted. How can i handle this problem ?

@jeffsteward
Copy link
Contributor

The hasimages parameter will find objects that have images regardless of the copyright status. We strip out image data if there are copyright issues hence the empty array and null values. You need to add the following parameter: q=imagepermissionlevel:0. This will reduce your data set to objects with images that have no known copyright issues.

See also related comments in #6 (comment).

@peterjcaulfield
Copy link

peterjcaulfield commented Mar 21, 2020

I'm hitting this issue every few images even with a query string that contains the params mentioned in the fix threads: imagepermissionlevel=0&hasimage=1.

Ex:

https://api.harvardartmuseums.org/object?page=1571&apikey=[REDACTED]&size=1&hasimage=1&imagepermissionlevel=0&classification=Paintings&people.role=Artist

@jeffsteward
Copy link
Contributor

You must use the q parameter whenever you are querying a field that is not named in the parameter list. In your case change imagepermissionlevel=0&hasimage=1 to q=imagepermissionlevel:0&hasimage=1.

@peterjcaulfield
Copy link

@jeffsteward Great thanks for clarifying! All looks good now 👍

@heatherca
Copy link

I'm still getting this issue even with the permission level parameter? Would love another set of eyes on it:
https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&primaryimageul=true&keyword=sun&q=imagepermissionlevel%3A0&page=2

@jeffsteward
Copy link
Contributor

@heatherca Some of the parameters in your query won't work. primaryimageurl isn't a named parameter. The only way to query fields that are not in [the list of named parameters] (https://github.com/harvardartmuseums/api-docs/blob/master/sections/object.md#get-objects ) is via the q parameter. Here's a reformatted version of your query.

https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&q=imagepermissionlevel:0 AND primaryimageurl:*&person=any&keyword=sun

That being said, I think you found a bug in our query logic. When I run the reformatted query I get more records than expected. I need to investigate further.

@heatherca
Copy link

That was my bad I was trying to throw more things onto to get it to work. I think the main issue was that q was being overridden by keyword. When I commented out keyword in my call all the results would have the correct imagepermissionlevel:0. I ended up using title instead of keyword which didn't have the same issue.

Would still get imagepermissionlevel not equal to zero:
https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&keyword=sun&q=imagepermissionlevel:0

This worked:
https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&title=sun&q=imagepermissionlevel:0

@jeffsteward
Copy link
Contributor

Thanks for the additional info. All signs point to a bad implementation of the keyword parameter. I'm going to log a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants