def search_records(
        self,
        name: str,
        task: TaskType,
        size: Optional[int] = None,
        **query,
    ):
        """
        Searches records over a dataset

        Args:
            name: The dataset name
            task: The dataset task type
            size: If provided, only the provided number of records will be fetched
            query: The search query

        Returns:
            An instance of ``SearchResults`` class containing the search results
        """

        if task == TaskType.text_classification:
            record_class = TextClassificationRecord
        elif task == TaskType.token_classification:
            record_class = TokenClassificationRecord
        elif task == TaskType.text2text:
            record_class = Text2TextRecord
        else:
            raise ValueError(f"Task {task} not supported")

        url = Search._API_URL_PATTERN.format(name=name, task=task.value)
        if size:
            url += f"?limit={size}"

        query = self._parse_query(query=query)
        response = self.http_client.post(
            path=url,
            json={"query": query} if query else None,
        )

        return SearchResults(
            total=response["total"],
            records=[record_class.parse_obj(r).to_client() for r in response["records"]],
        )

        Searches records over a dataset

        Args:
            name: The dataset name
            task: The dataset task type
            size: If provided, only the provided number of records will be fetched
            query: The search query

        Returns:
            An instance of ``SearchResults`` class containing the search results
        
argilla-v1/src/argilla_v1/client/apis/search.py