Sort the search results by a certain field.

        If this method is called multiple times, the later sort fields are given lower priority,
        and will only be considered when the eariler fields have the same value.

        Arguments:
            field (str): The field to sort by.
                    The field must be namespaced according to Elasticsearch rules
                    using the dot syntax.
                    For example, ``"mdf.source_name"`` is the ``source_name`` field
                    of the ``mdf`` dictionary.
            ascending (bool): If ``True``, the results will be sorted in ascending order.
                    If ``False``, the results will be sorted in descending order.
                    **Default**: ``True``.
        Returns:
            SearchHelper: Self

def add_sort(self, field, ascending=True):
        """Sort the search results by a certain field.

        If this method is called multiple times, the later sort fields are given lower priority,
        and will only be considered when the eariler fields have the same value.

        Arguments:
            field (str): The field to sort by.
                    The field must be namespaced according to Elasticsearch rules
                    using the dot syntax.
                    For example, ``"mdf.source_name"`` is the ``source_name`` field
                    of the ``mdf`` dictionary.
            ascending (bool): If ``True``, the results will be sorted in ascending order.
                    If ``False``, the results will be sorted in descending order.
                    **Default**: ``True``.
        Returns:
            SearchHelper: Self
        """
        # No-op on blank field
        if not field:
            return self
        self._add_sort(field, ascending=ascending)
        return self