docstr: 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
docstr_tok: ["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"]
code: 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 = self._API_URL_PATTERN.format(name=name, task=task)
      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"]
          ],
      )
  
file_path: argilla/src/argilla/client/apis/search.py
imports: import dataclasses
  from typing import List, Optional
  from argilla.client.apis import AbstractApi
  from argilla.client.models import Record
  from argilla.client.sdk.datasets.models import TaskType
  from argilla.client.sdk.text2text.models import Text2TextRecord
  from argilla.client.sdk.text_classification.models import TextClassificationRecord
  from argilla.client.sdk.token_classification.models import TokenClassificationRecord
label_desc: Use image node_id 1 for calling the Search obj's underlying member method code with example usage: obj.search_records(name, task, size) and returns: SearchResults