def update_node_stats(self):

        def merge_df_map(target, source):
            '''
            Helper function to merge df_maps.
            '''
            for (term, df) in source.items():
                if term not in target: target[term] = 0
                target[term] += df

        # Collect global stats
        self._N = 0
        self._df_map = {}
        name_to_docid_maps = {}
        for shard_id in range(len(self._shards)):
            shard = self._shards[shard_id]
            self._N += shard.get_local_N()
            merge_df_map(self._df_map, shard.get_local_df_map())
            name_to_docid_maps[shard_id] = shard.get_name_to_docid_map()

        # Update our name <-> node_docid mapping
        for (shard_id, name_to_docid_map) in name_to_docid_maps.iteritems():
            for (name, docid) in name_to_docid_map.iteritems():
                gdocid = self.make_node_docid(shard_id, docid)
                self._name_to_docid_map[name] = gdocid
                self._docid_to_name_map[gdocid] = name
Fetches local stats from all shards, aggregates them, and
dataset/ETHPy150Open taherh/pysimsearch/pysimsearch/sim_index/sim_index_collection.py/SimIndexCollection.update_node_stats