Skip to content

Commit

Permalink
fix: database index schemes update
Browse files Browse the repository at this point in the history
  • Loading branch information
Crissium committed Nov 23, 2023
1 parent d544d22 commit aabb743
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server/app/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,20 @@ def delete_dictionary(dictionary_name: 'str') -> 'None':
def create_index() -> 'None':
cursor = get_cursor()
# cursor.execute('create index idx_dictname on entries (dictionary_name)') # This helps with dictionary_exists()
# cursor.execute('create index idx_key_dictname on entries (key, dictionary_name)')
cursor.execute('create index idx_key_dictname on entries (key, dictionary_name)')
# cursor.execute('create index idx_key on entries (key)')
cursor.execute('create index idx_key_dictname_word on entries (key, dictionary_name, word)')
# cursor.execute('create index idx_key_dictname_word on entries (key, dictionary_name, word)')
cursor.execute('create index idx_word_dictname on entries (word, dictionary_name)')

def drop_index() -> 'None':
cursor = get_cursor()
#### For backwards compatibility, so to speak
#### For backwards compatibility
cursor.execute('drop index if exists idx_dictname')
cursor.execute('drop index if exists idx_key_dictname')
cursor.execute('drop index if exists idx_key_dictname_word')
cursor.execute('drop index if exists idx_key')
####
cursor.execute('drop index if exists idx_key_dictname_word')
cursor.execute('drop index if exists idx_key_dictname')
cursor.execute('drop index if exists idx_word_dictname')

def select_entries_beginning_with(keys: 'list[str]', names_dictionaries: 'list[str]', words_already_found: 'list[str]', limit: 'int') -> 'list[str]':
"""
Expand Down

0 comments on commit aabb743

Please sign in to comment.