Delete tags
It would be useful if you can delete tags having an option or button I know that the only way to do that is selecting the cards or notes and change the tag for a different one and after that check the database. But it would be quicker with an option
This is one of the least intuitive parts of the app, in my opinion. I agree with you. May I ask, @javiercl2020 - how does AnkiDesktop (and/or AnkiMobile - the iOS app) handle it now?
I don't have the ios app I didn't find the way to delete tags using Anki desktop tomorrow I will try again
The way I deleted tags in Anki desktop is:
- Go to
browse - In the sidebar filter you will see
Tags - Right click on the tag you want to delete and you will get an option to do so

Neat - thanks @viciousAegis - so I assume (untested, please correct if I'm wrong) that it will first find all cards that have the tag, remove the tag from them cards, then check database? Or perhaps newer versions of anki desktop have this as a real method in the library (which we reuse via Anki-Android-Backend...) such that it is clean+easy. Those are further question where the answers would inform future work - checking the Desktop code to see how exactly it's implemented, as a next step
It will be when we update our backend to the latest version, best to focus on schema 16 before introducing more breaking changes.
https://github.com/ankitects/anki/blob/main/proto/anki/tags.proto
got it - thanks!
Hello π, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
Hello π, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
We are really really close to having the backend updated with #11644 at which point this does become much easier.
Just requires exposing col.newBackend.backend.removeTags()
Hello π, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
Too easy not to keep open as a feature request
I wanna work on this issue, where should I start with?
@Sagar0-0 find any code (via search) that is conditional on legacy backend, use git blame to find the commits that added or changed the legacy backend conditional, and examine the related PRs to see how code for the new backend works. Second, find any menu items that are added dynamically in the deck list and do the same
Ok getting started now
Found 3 usage in Storage. While using git blame in this file I found that particular commit "Use Rust backend for database queries". How to find the corresponding PR? and is this even the right thing I am doing?
I think that's the method in Anki Desktop which removes the tags(from the list awa notes)
There are some brief instructions on https://github.com/ankidroid/Anki-Android/issues/11882 if you haven't already read them.
Well, I found that same method in proto also , and now do I have to add some new function in CollectionV16 and TagsV16 classes that call the associated backend function to remove the tag?
Any update here?
Yes, that is correct.
I think first I have to try anki desktop also and see how it behaves with new tags and older tags.
@Sagar0-0 there is already a comment above showing how it works on Anki Desktop.
The task here is maybe going to be difficult because there is no spot really where the tags are editable and I'm not sure where that would even fit in the UI π€ .
There is a tag browser component which may be reusable - it is visible in the card browser if you filter by tag, but there is no long-press ability there. Perhaps the easiest thing just to get this hooked up is to respond to a long-press on a tag in that existing tag filter popup to make yet another popup that gives you options for the tag. Just one option right now for delete, and make it all connect to the backend function and work.
Once it is actually working at all - even if the UX is not great - a follow-on step could be to add a "tag browser" option in the menu for card browser, and in there show the tag widget (which now allows for delete on long-press...) and start adding more features like rename etc.
But just start - maybe if you investigate and it looks doable - by listening for long-press on the existing tag component and make delete work ?
aye aye captain
I did it! Trying to add a workable UI now! I also know the backend proto method that is required but I am not aware about abstraction layers that have to be added on different levels. After searching I got that first I have to add the methods in CollectionsV16 and TagsV16 but gotta stress more to understand the abstraction level for working with these classes. Any helpful tips here?
On long press I am showing a dialog(similar to Help and Support Android dialog) with currently a single option of Delete tag(later we can also add rename).
LGTM, clean and simpleπ. P.s. It also persist config changes.
If I have to also set a title here, then what it should be?
If I have to also set a title here, then what it should be?
The tag name
done
Progress report
- Added Dialog to onLongPressListener on Tag (also persist config change).
- Dialog contains the Title(as tag name) and option to delete.
- Added a delete method in TagsList class that returns boolean (One liner function bcz we are calling UniqueArrayList remove method [this is working and not working, I think that is because it restores the tags everytime as we are not removing them properly]).
- On choosing delete option of dialog we call the corresponding delete method of TagsList
- We create a MaterialDialog snackbar withe the appropriate feedback message, whether tag is deleted or not.
- Call notifyDataSetChanged and sortData methods of TagsArrayAdapter
- Added a function inTagsV16 that calls the removetags function of backend.
Need help in
- I think(not sure) I have to add delete fxn in UniqueArrayList and call that from tagslist class.
- Don't know(abstraction layers)how to reach TagsV16 and call the delete function from UniqueArrayList class.
- What is this OpChangesWithCount and do this thing have any uses?
- It is good to also add delete abstract method in TagsManager as it is the parent of TagsV16.
- Do I also have to make changes in the docstrings side by side?