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

SEARCH-666: Use quality names rather than numeric IDs #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reosarevok
Copy link
Member

@reosarevok reosarevok commented Feb 2, 2023

Fix SEARCH-666

Problem

Our documentation claims that you can search release quality using the words "high", "normal" and "low". That's not the case though - for some reason, release indexing was implemented by just indexing the quality as a number straight from the DB.

This causes several problems:

  • It's inconsistent with lookup and browse calls, which return quality as text (searches do not return quality at all, which seems suboptimal, added SEARCH-698 for that).
  • Something breaks when searching for low quality releases by passing 0 (maybe it's being evaluated as falsy).
  • It is undocumented and goes against user expectation since these numeric IDs are not exposed anywhere on the website AFAICT
  • Normal is split between 1 and -1 - we do this at the database level to know which releases have been set to normal manually (1) vs the ones that have the default quality level (-1) but we do not differentiate them in user-facing locations elsewhere.

Solution

Add a transform function quality_to_string that maps 0 to low, 2 to high, and other options (that is, -1 and 1) to normal. This matches what we do elsewhere in the API, matches what was listed in our documentation, and removes the split between -1 (default) and 1 (normal) which we don't generally expose to data users.

Testing

Updated the testing data so that not all the qualities are -1, otherwise just letting the existing test do its thing.

Actions

This matches what we do elsewhere in the API, matches what was listed
in our documentation, and removes the split between -1 (default)
and 1 (normal) which we don't generally expose to data users.
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

Successfully merging this pull request may close these issues.

1 participant