I have multiple decks for foreign language learning, usually just words with their English translations. The first deck, I’ll call it deck A, was quite extensive with many common words. I recently started a new deck which I’ll call deck B, and got it started with importing a lot of cards from csv. I imported into deck B, but some cards were added to deck A directly, and some overwrote deck A cards due I guess to having the same value on the sort (English) field.
I noticed very quickly the importing into the incorrect deck issue, but it’s taken longer to realize the overwrites and the result is cards in deck A with deck B content as well as missing cards in deck A, which would be frustrating on its own if A and B were more clearly different languages…but they are French and Spanish, oh no. It turned out to be worth just reverting to a backup with the plan to re-add cards.
I did observe during the import process that there was the option to update vs add. I left it on update because I knew that I was using cards created by someone else, with some redundancies, so that updates existed didn’t concern me. However, I also saw redundancies (same value in Sort field) after import despite that, so I’m not really sure how/if this is working.
When this happens again, what info can I access to better report this issue? I get that right now this isn’t the most useful bug report, especially since I didn’t observe a reproduceable pattern.
First, hopefully you were able to either Edit > Undo the import, or restore from an automatic backup to get things straightened out.
This obviously wasn’t what you intended to have happen, but I’m not sure it’s a bug. This sounds like expected behavior if you’re importing duplicate notes – same note type, same first field. Text Files - Anki Manual
Probably the best ways to deal with this are to avoid it –
Specify what deck you’re importing to – either in your File Headers, a deck column, or the import options window.
Use distinct note types for things that shouldn’t be merged/updated.
Makes sure your notes use the unique language as their 1st field, instead of the common language.
You have to keep the other things Danika_Dakika mentioned in mind too:
If you already have a card A in anki and import another card B where the first field is the same, then anki is supposed to overwrite that card if “update” is chosen. That’s expected behavior.
You could create a custom first field though, naming it something like ID and then add a string to it like my_custom_id_00000001. You could then increment this number in the id for new cards. That way you can have the same word on the front and even update the correct cards without having to worry about possible duplicates being overwritten during import.
My response addresses item 1 in Danika’s list, so I’m unsure why you are spelling out this workaround solution which is effectively a hack for undesired behavior.
Additionally, though I missed Danika’s mention of this before, these were a different note type. I cloned note type A to make a similar note type B. The imported cards were set to import as note type B, and the new cards successfully imported as such. The cards that were updated in deck A were retained as note type A.
Also note in the link to the manual from Danika, I note that under Import Options, the “match scope” option defaults to match on “Note Type”, and can be changed to match on “Note Type and Deck”. Using that latter option is defined as the correct solution in the manual to the deck-mismatch issue. But, again, this import matched beyond note type.
Yes, but as a said: The other points are relevant too.
Well, anki has no idea what card belongs to which if you import via csv. In anki, cards do have ids (that the user normaly doesn’t see). The only info anki has is the first field. So if the first field matches (since IDs are lacking in csv imports) anki has to assume that this card in anki and that card in the csv are “the same card”, which you – the user – wants to update. Edit: This of course assumes the same note type is set. But you said this later on:
So the above is probably not relevant for you.
Reading through the posts again I think I understand what you mean. But if I do understand, then I cannot reproduce. Here’s what I did:
Create a csv with some sample content.
Create note type for the cards in csv.
Create deck A.
Import csv into deck A.
Clone note type from #2.
Create deck B.
Import csv into deck B, making sure that in import options the cloned notetype is set, as well as deck B, existing notes update, match scope note type and deck.
If I do this the cards from deck A and note type A are not touched.