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

make tag browsing case-insensitive and unique #1807

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

Conversation

quimmrc
Copy link
Contributor

@quimmrc quimmrc commented Dec 17, 2024

Issue(s)
#1312

Description
In the tag view, make the multiple_tags list elements to be lowercased and unique, in order to get a proper search_filter

Note: I do not really understand why uppercase tags exist, other than by directly writing them into the url I have not found a way to use them in the Freesound website. However I guess this is still useful.

if multiple_tags:
multiple_tags = multiple_tags.split('/')
else:
multiple_tags = []
multiple_tags = sorted([x for x in multiple_tags if x])
#Make all tags lower-cased and unique to get a case-insensitive search filter and shortened browse url
multiple_tags = sorted(set([x.lower() for x in multiple_tags if x]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to for the list comprehension if we turn it into a set anyways

Suggested change
multiple_tags = sorted(set([x.lower() for x in multiple_tags if x]))
multiple_tags = sorted({x.lower() for x in multiple_tags if x})

@@ -152,7 +152,7 @@ def search_view_helper(request):
'tags_mode': sqp.tags_mode_active(),
'query_time': results.q_time
}))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick: Consider setting your editor to trim all trailing whitespace automatically or use a code formatter

@Bomme
Copy link
Contributor

Bomme commented Jan 13, 2025

Note: I do not really understand why uppercase tags exist, other than by directly writing them into the url I have not found a way to use them in the Freesound website. However I guess this is still useful.

I think it's still possible to add both lower-case and upper-case tags when uploading a Sound or when changing a sounds description.

@ffont
Copy link
Member

ffont commented Jan 20, 2025

@quimmrc when you have some time have a look at @Bomme 's comments so we can go ahead and merge this. Thanks!

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.

3 participants