def __init__(self, fname, num_features, shardsize=SHARD_SIZE, topsims=TOP_SIMS):
self.fname = fname<EOL>self.shardsize = int(shardsize)<EOL>self.topsims = int(topsims)<EOL>self.id2pos = {} <EOL>self.pos2id = {} <EOL>self.id2sims = SqliteDict(self.fname + '<STR_LIT>', journal_mode=JOURNAL_MODE) <EOL>self.qindex = gensim.similarities.Similarity(self.fname + '<STR_LIT>', corpus=None,<EOL>num_best=None, num_features=num_features, shardsize=shardsize)<EOL>self.length = <NUM_LIT:0><EOL>
Spill index shards to disk after every `shardsize` documents.
In similarity queries, return only the `topsims` most similar documents.