def METHOD_NAME(self, path, query_idx, num_queries):
    assert query_idx + 1 == num_queries
    assert num_queries == self.total_queries
    if self.max_query_idx < query_idx:
        self.log(query_idx)
    self.print_metrics(query_idx)
    output = defaultdict(dict)
    for depth in sorted(self.mrr_sums):
        score = self.mrr_sums[depth] / (query_idx+1.0)
        output['mrr'][depth] = score
    for depth in sorted(self.success_sums):
        score = self.success_sums[depth] / (query_idx+1.0)
        output['success'][depth] = score
    for depth in sorted(self.recall_sums):
        score = self.recall_sums[depth] / (query_idx+1.0)
        output['recall'][depth] = score
    with open(path, 'w') as f:
        ujson.dump(output, f, indent=4)
        f.write('\n')