An instance of lunr.MatchData will be created for every term that
        matches a document.

        However only one instance is required in a lunr.Index~Result. This
        method combines metadata from another instance of MatchData with this
        object's metadata.

def combine(self, other):
        """An instance of lunr.MatchData will be created for every term that
        matches a document.

        However only one instance is required in a lunr.Index~Result. This
        method combines metadata from another instance of MatchData with this
        object's metadata.
        """
        for term in other.metadata.keys():
            if term not in self.metadata:
                self.metadata[term] = {}

            fields = other.metadata[term].keys()
            for field in fields:
                if field not in self.metadata[term]:
                    self.metadata[term][field] = {}

                keys = other.metadata[term][field].keys()
                for key in keys:
                    if key not in self.metadata[term][field]:
                        self.metadata[term][field][key] = other.metadata[term][field][
                            key
                        ]
                    else:
                        self.metadata[term][field][key].extend(
                            other.metadata[term][field][key]
                        )