Skip to content

Commit

Permalink
Merge 354637d into fcf69dd
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Dec 24, 2022
2 parents fcf69dd + 354637d commit 46af9b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ankipandas/raw.py
Expand Up @@ -325,14 +325,22 @@ def encode_value(value):
df.to_sql("col", db, if_exists="replace", index=False)


def update_note_indices(db: sqlite3.Connection):
def update_note_indices(db: sqlite3.Connection) -> None:
"""Update search indices for 'notes' table. This does not modify any information
in the table itself.
See https://github.com/klieret/AnkiPandas/issues/124 for more informationl
"""
cur = db.cursor()
cur.execute("CREATE INDEX IF NOT EXISTS idx_notes_mid ON notes (mid)")
cur.execute("CREATE INDEX IF NOT EXISTS ix_notes_csum on notes (csum)")
cur.execute("CREATE INDEX IF NOT EXISTS ix_notes_usn on notes (usn)")


def update_card_indices(db: sqlite3.Connection):
def update_card_indices(db: sqlite3.Connection) -> None:
"""Update search indices for 'cards' table. This does not modify any information
in the table itself.
See https://github.com/klieret/AnkiPandas/issues/124 for more informationl
"""
cur = db.cursor()
cur.execute(
"CREATE INDEX IF NOT EXISTS idx_cards_odid ON cards (odid) WHERE odid != 0"
Expand Down

0 comments on commit 46af9b7

Please sign in to comment.