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

Searching via API using the search term '0' without asterisk (0*) fails #1275

Closed
miguelvaara opened this issue Feb 16, 2022 · 4 comments · Fixed by #1276
Closed

Searching via API using the search term '0' without asterisk (0*) fails #1275

miguelvaara opened this issue Feb 16, 2022 · 4 comments · Fixed by #1276
Assignees
Milestone

Comments

@miguelvaara
Copy link
Contributor

miguelvaara commented Feb 16, 2022

At which URL did you encounter the problem?

https://api.dev.finto.fi/rest/v1/ykl/search?query=0

What steps will reproduce the problem?

  1. Go https://api.finto.fi/rest/v1/ykl/search?query=0

What is the expected output? What do you see instead?

It turned out that the fixes in the PR #1261 do not work completely (mostly it works 👍 ). There is still a problem with the searches with zeros ('0') if you do not use a trailing asterisk with the number zero.

https://api.finto.fi/rest/v1/ykl/search?query=0 should return a result containing the concept https://dev.finto.fi/ykl/en/page/0 (http://urn.fi/URN:NBN:fi:au:ykl:0) but it returns an empty result.

What browser did you use? (eg. Firefox, Chrome, Safari, Internet explorer)

FF

@miguelvaara miguelvaara self-assigned this Feb 16, 2022
@kinow

This comment was marked as outdated.

@kinow

This comment was marked as outdated.

@kinow
Copy link
Collaborator

kinow commented Feb 17, 2022

The issue description has URLs to dev.finto and to finto. The version in finto is a little behind, so it will display an older bug, saying that the query parameter is missing.

should return a result containing the concept https://dev.finto.fi/ykl/en/page/0 (http://urn.fi/URN:NBN:fi:au:ykl:0) but it returns an empty result.

👍 if I search for 00 it works. 00.1 also brings the right results. But 0 is not returning the concept above 😕

@kinow
Copy link
Collaborator

kinow commented Feb 17, 2022

Found the 🐛 :

if (!$term && $this->rest)

When query=0, the !$term evaluates to true, and it uses label instead. You can test with the URL: https://api.dev.finto.fi/rest/v1/ykl/search?query=0&label=0

PR with the fix on its way... 🏃

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

Successfully merging a pull request may close this issue.

2 participants