def merge(self, other):
other.qindex.normalize, other.qindex.num_best = False, self.topsims<EOL>logger.info("<STR_LIT>")<EOL>pos, lenself = <NUM_LIT:0>, len(self.qindex)<EOL>for chunk in self.qindex.iter_chunks():<EOL><INDENT>for sims in other.qindex[chunk]:<EOL><INDENT>if pos in self.pos2id:<EOL><INDENT>docid = self.pos2id[pos]<EOL>sims = self.sims2scores(sims)<EOL>self.id2sims[docid] = merge_sims(self.id2sims[docid], sims, self.topsims)<EOL><DEDENT>pos += <NUM_LIT:1><EOL>if pos % <NUM_LIT> == <NUM_LIT:0>:<EOL><INDENT>logger.info("<STR_LIT>" % (pos, lenself))<EOL><DEDENT><DEDENT><DEDENT>self.id2sims.sync()<EOL>logger.info("<STR_LIT>")<EOL>pos, docids = <NUM_LIT:0>, []<EOL>for chunk in other.qindex.iter_chunks():<EOL><INDENT>for vec in chunk:<EOL><INDENT>if pos in other.pos2id: <EOL><INDENT>self.qindex.add_documents([vec])<EOL>docids.append(other.pos2id[pos])<EOL><DEDENT>pos += <NUM_LIT:1><EOL><DEDENT><DEDENT>self.qindex.save()<EOL>self.update_ids(docids)<EOL>logger.info("<STR_LIT>")<EOL>pos, lenother = <NUM_LIT:0>, len(other.qindex)<EOL>norm, self.qindex.normalize = self.qindex.normalize, False<EOL>topsims, self.qindex.num_best = self.qindex.num_best, self.topsims<EOL>for chunk in other.qindex.iter_chunks():<EOL><INDENT>for sims in self.qindex[chunk]:<EOL><INDENT>if pos in other.pos2id:<EOL><INDENT>docid = other.pos2id[pos]<EOL>self.id2sims[docid] = self.sims2scores(sims)<EOL><DEDENT>pos += <NUM_LIT:1><EOL>if pos % <NUM_LIT> == <NUM_LIT:0>:<EOL><INDENT>logger.info("<STR_LIT>" % (pos, lenother))<EOL><DEDENT><DEDENT><DEDENT>self.qindex.normalize, self.qindex.num_best = norm, topsims<EOL>self.id2sims.sync()<EOL>
Merge documents from the other index. Update precomputed similarities
        in the process.