Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

[FEATURE] fixed tags duplicate issue in discovery page due to case sensitivity #3721

Closed
wants to merge 6 commits into from
Closed

Conversation

rwiteshbera
Copy link
Member

@rwiteshbera rwiteshbera commented Jan 20, 2023

Closes #3604

Fixes Issue

Fixed tags duplicate issues in discovery page due to case sensitivity

Before: JavaScript(10), javascript(5), Javascript(2)
After: javascript(17)

Changes proposed

While displaying the tags, I have added a snippet that will do the following task with all the tags:

  1. Trim whitespace from both sides of the string.
  2. Converted into lowercase
  3. Replaced all the special characters with ''. (Example: react.js -> reactjs)
  4. If the current tag name already exists as a key in the accumulated object, increment the value by the current tag's total count. If the tag name does not exist in the object, add a new key with the current tag's total count as the value.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

image

Note to reviewers

Please let me know if there are any changes or updates needed before it can be merged. I am open to suggestions and feedback to ensure that the code is of the highest quality.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

It's great having you contribute to this project

Welcome to the community 🤓

If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.

@github-actions github-actions bot added the medium Pull request with changed lines between 10 and 30 label Jan 20, 2023
@github-actions
Copy link
Contributor

Welcome @rwiteshbera! Thank you so much for your first pull request!

Copy link
Member

@eddiejaoude eddiejaoude left a comment

Choose a reason for hiding this comment

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

This is a great idea, but I think it would be best to happen on the server side here https://github.com/EddieHubCommunity/LinkFree/blob/main/pages/api/discover/tags.js

I think to keep things super simple we could lowercase all tags

Copy link
Contributor

@ManishBisht777 ManishBisht777 left a comment

Choose a reason for hiding this comment

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

on the backend part stats are still set differently reactjs, and react js so if I search for reactjs I will not get results for react js

so I think putting the data in the server in the right format seems a better option

@rwiteshbera
Copy link
Member Author

rwiteshbera commented Jan 20, 2023

Hi, @eddiejaoude, I guess it would be beneficial to reorganize and reformat the current data by converting it to a standardized format, such as making all letters lowercase and removing any special characters or spaces.
A new function can be added to ensure that any new data entered is automatically reformatted to the correct format.

@eddiejaoude
Copy link
Member

I think then we are trying to build a search engine, which we don't want to do. There is an issue to improve the search using libraries/tools that focus on search #900

@eddiejaoude
Copy link
Member

eddiejaoude commented Jan 23, 2023

Thank @rwiteshbera for the improvement, the tags do looks better when listed on the Discover page, howeer then the results don't match when a tag is clicked and searched.

This could be solved when performing the search applying the same logic to the users tag, but then we would need to apply the same for the users profile tag list also.

But really we should not be changing how the tags are displayed on their profiles, but improving the search results. Please see #900 as mentioned previously

@rwiteshbera
Copy link
Member Author

Could you please provide me with some screenshots so I can proceed with my local setup, as it is currently functioning properly? In my case, both results look the same when I am searching or clicking on the user's tag.

@eddiejaoude
Copy link
Member

How does this affect the search? For example instead of JavaScript(10), javascript(5), Javascript(2) it shows javascript(17) but when searching will it show the correct results of 17 or something else?

@rwiteshbera
Copy link
Member Author

Hi, @eddiejaoude , I am getting correct results here.
Screenshot 2023-01-27 164335

image

@eddiejaoude
Copy link
Member

Thank you for your contribution. This recently got removed from the Discovery page. So I will close this PR.

We are creating more issues, so keep an eye on there for more

@eddiejaoude eddiejaoude closed this Feb 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2023

Welcome @rwiteshbera! Thank you so much for your first pull request!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
medium Pull request with changed lines between 10 and 30
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] tags in discovery duplicate due to case sensitivity
3 participants