Commits

Sam Toyer committed 4b7f7f0

Remove unused inverse index functionality

Comments (0)

Files changed (1)

 MAPDB_FILENAME = 'mapdb.json'
 # map fts index
 FTSINDEX_FILENAME = 'ftsindex.json'
-# map inverse indices (for gametype, etc)
-INVINDEX_FILENAME = 'invindex.json'
-# keys which require an inverse index (for uber-fast search)
-INVERSE_INDEX_KEYS = ['gametype']
 CONFIG_FILENAME = 'config.json'
 THUMB_PATH = 'thumbs/'
 TEMPLATE_FILENAME = 'template.html'
                 rv[fieldname][word][key] += 1
     return rv
 
-def create_inverse_indices(mapdb, keys=INVERSE_INDEX_KEYS):
-    inv = defaultdict(lambda: defaultdict(lambda: []))
-    for mapkey in mapdb:
-        for valkey in mapdb[mapkey]:
-            if valkey not in keys: continue
-            for val in mapdb[mapkey][valkey]:
-                inv[valkey][val].append(mapkey)
-    return inv
-
 def build_mapdb(files, write_images=False, image_path=path.join(BUILD_PATH, THUMB_PATH)):
     maps = (Map(fn) for fn in files)
     mdb = {}
     mapdb_dict = build_mapdb(map_iterator(MAP_PATH), write_images=True)
     print "Loaded {0} maps".format(len(mapdb_dict))
     ftsindex_dict = create_ftsindex(mapdb_dict)
-    invindex_dict = create_inverse_indices(mapdb_dict)
     write_json(mapdb_dict, path.join(BUILD_PATH, MAPDB_FILENAME), 'mapdb')
     write_json(ftsindex_dict, path.join(BUILD_PATH, FTSINDEX_FILENAME), 'ftsindex')
-    write_json(invindex_dict, path.join(BUILD_PATH, INVINDEX_FILENAME), 'mapinvindex')
     write_json(CONFIG, path.join(BUILD_PATH, CONFIG_FILENAME), 'config')
     render_index(TEMPLATE_FILENAME, BUILD_PATH, conf=CONFIG, mapdb=mapdb_dict)
     transfer_static_files(STATIC_PATH, BUILD_PATH)