fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
179 stars 24 forks source link

Adding regular cards is always associated with a pdf #180

Open merlin-studios opened 3 years ago

merlin-studios commented 3 years ago

Hi! love the addon!

I'm having an issue that is likely user error. Whenever I want to add a regular Anki card that isn't associated with any kind of pdf it still ends up being linked to a pdf. I'm not sure if this is because I have a setting or tag that is doing this or perhaps I have the reader window open somewhere when I'm adding the card.

For example, if I just add two regular Anki cards that I don't want to be associated with a pdf this would show up later when looking at the pdf (additionally I get the dialog box asking if I want to review these cards before reading). Clicking through all the pages I can't find the two cards at all.

anki_pdf_pic

fonol commented 3 years ago

Hi, thanks for the report. Not sure what is causing this. Initially when I read your post, I thought this was a misunderstanding, because the "added x cards" on the bottom of the sidebar simply displays the number of cards added in general, not specific to the opened pdf. But then you said that it wants to review those cards when you open the PDF, but no notes are displayed in the sidebar, and this definitely points to some bug.

The add-on is stupid in regards of th linking and takes a created note and a PDF/add-on note as linked if you have it opened while you create the note. So first question would be, do you think you had the add-on's reader opened while creating those cards? Do you have like a minimal example which reproduces the issue for you? That would be helpful. Are the notes that are wrongly linked of any specific type (i.e. normal notes or Image Occlusion notes)?

p4nix commented 3 years ago

I think I've once had the problem of notes with illegal NIDs (NIDs having too many digits) getting associated with PDFs. I might be wrong though. I had to manually remove these NIDs from the SIAC database to fix the error, after fixing the NID being too long with a SQL command in the Anki debug console...

Perhaps checking the notes_pdf_page table in an SQL editor of the siac-notes.db database file might provide some insights. Maybe make a backup of the database before and do not alter the database, unless you know what you are doing. image

merlin-studios commented 3 years ago

Ok so I'm actually having a hard time reproducing the bug which makes me think I just had the reading window open when I made the cards (they were optional reverse cards by the way). I'll definitely keep an eye out to see if it happens again.