Merged
Conversation
…tes() call when possible
Merged
KamWithK
reviewed
Oct 3, 2023
app/src/main/java/com/kamwithk/ankiconnectandroid/ankidroid_api/NoteAPI.java
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If all of the model names are the same in
canAddNotes(which is always true for Yomichan, because Yomichan only attempts to add one note type), then we can optimize the call using AnkiDroid'sfindDuplicateNotescall. This speeds up duplicate checks quite a bit from personal testing.If the model names are not all the same, then we fallback to the original code.
The README still recommends to have the max results as
8because the default 32 results is still a bit slow compared to the PC version. (Note: "max results" means the maximum number of results from Yomichan's popup, i.e. underGeneral->Maximum number of results)The optimized query may partially fix quotes and spaces not working in the key field, because AnkiDroid's internal implementation uses a checksum instead of comparing the raw field. This does not fix Yomichan's
findNotescall though, so the book (to open the most recent card) may not show.Depends on #42