def get_target_index(lang):
 name = ('target-%s' % lang)
 try:
  exists = STORAGE.index_exists(name)
 except OSError:
  create_index()
  exists = False
 if (not exists):
  create_target_index(lang)
 index = STORAGE.open_index(name)
 if ('comment' not in index.schema):
  index.add_field('comment', TEXT())
 if ('pk' not in index.schema):
  index.add_field('pk', NUMERIC(stored=True, unique=True))
 if ('checksum' in index.schema):
  index.remove_field('checksum')
 return index

def get_target_index ( lang ) : name = ( 'target-%s' % lang ) try : exists = STORAGE . index_exists ( name ) except OSError : create_index ( ) exists = False if ( not exists ) : create_target_index ( lang ) index = STORAGE . open_index ( name ) if ( 'comment' not in index . schema ) : index . add_field ( 'comment' , TEXT ( ) ) if ( 'pk' not in index . schema ) : index . add_field ( 'pk' , NUMERIC ( stored = True , unique = True ) ) if ( 'checksum' in index . schema ) : index . remove_field ( 'checksum' ) return index
returns target index object .