Find and get message IDs by query

        :param query: Text to search for
        :param offset: Number of messages to skip
        :param limit: Max. number of messages to retrieve
        :param thread_id: User/Group ID to search in. See :ref:`intro_threads`
        :type offset: int
        :type limit: int
        :return: Found Message IDs
        :rtype: generator
        :raises: FBchatException if request failed

def searchForMessageIDs(self, query, offset=0, limit=5, thread_id=None):
        """
        Find and get message IDs by query

        :param query: Text to search for
        :param offset: Number of messages to skip
        :param limit: Max. number of messages to retrieve
        :param thread_id: User/Group ID to search in. See :ref:`intro_threads`
        :type offset: int
        :type limit: int
        :return: Found Message IDs
        :rtype: generator
        :raises: FBchatException if request failed
        """
        thread_id, thread_type = self._getThread(thread_id, None)

        data = {
            "query": query,
            "snippetOffset": offset,
            "snippetLimit": limit,
            "identifier": "thread_fbid",
            "thread_fbid": thread_id,
        }
        j = self._post(
            self.req_url.SEARCH_MESSAGES, data, fix_request=True, as_json=True
        )

        result = j["payload"]["search_snippets"][query]
        snippets = result[thread_id]["snippets"] if result.get(thread_id) else []
        for snippet in snippets:
            yield snippet["message_id"]