Skip to content

Don't use AnkiConnect's duplicate check #641

@ale18V

Description

@ale18V

So I was trying to create a custom regex for a note type. Although the regex was correctly matching I couldn't get the plugin to generate notes using that regex. I assumed that the plugin was maybe adding some flags or handling it in some weird way so I kept trying to switch up the regex but without any success.

So I ended up checking the obsidian's console and I saw that my note was indeed matching but was not being created: Failed to add note { Note JSON } due to error cannot create note because it is a duplicate.
I looked into it and found that the error was due to AnkiConnect as it's being called with:

{
  "options": {
    "allowDuplicate": false,
    "duplicateScope": "deck"
  }
}

It appears that AnkiConnect checks whether a note is duplicate or not by comparing the main field of the note. While this is arguably not a good idea on their side, I believe we should set allowDuplicate" to true` as this hidden behaviour is probably not what most users want. At least for me, it did cause much headache.

I'm opening a PR for this issue if it welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions