class_docstr: Text classification service
class_docstr_tok: ["Text","classification","service"]
docstr: Run a search in a dataset
  
  Parameters
  ----------
  dataset:
      The records dataset
  query:
      The search parameters
  sort_by:
      The sort by list
  record_from:
      The record from return results
  size:
      The max number of records to return
  Returns
  -------
      The matched records with aggregation info for specified task_meta.py
docstr_tok: ["Run","a","search","in","a","dataset","Parameters","--","--","--","--","--","dataset",":","The","records","dataset","query",":","The","search","parameters","sort_by",":","The","sort","by","list","record_from",":","The","record","from","return","results","size",":","The","max","number","of","records","to","return","Returns","--","--","--","-","The","matched","records","with","aggregation","info","for","specified","task_meta.py"]
code: def search(
      self,
      dataset: ServiceTextClassificationDataset,
      query: ServiceTextClassificationQuery,
      sort_by: List[ServiceSortableField],
      record_from: int = 0,
      size: int = 100,
      exclude_metrics: bool = True,
  ) -> ServiceSearchResults:
      """
      Run a search in a dataset
  
      Parameters
      ----------
      dataset:
          The records dataset
      query:
          The search parameters
      sort_by:
          The sort by list
      record_from:
          The record from return results
      size:
          The max number of records to return
      Returns
      -------
          The matched records with aggregation info for specified task_meta.py
  
      """
  
      metrics = [
          TextClassificationMetrics.find_metric(id)
          for id in {
              "words_cloud",
              "predicted_by",
              "predicted_as",
              "annotated_by",
              "annotated_as",
              "error_distribution",
              "status_distribution",
              "metadata",
              "score",
          }
      ]
  
      results = self.__search__.search(
          dataset,
          query=query,
          record_type=ServiceTextClassificationRecord,
          record_from=record_from,
          size=size,
          exclude_metrics=exclude_metrics,
          metrics=metrics,
          sort_config=ServiceSortConfig(
              sort_by=sort_by,
          ),
      )
  
      if results.metrics:
          results.metrics["words"] = results.metrics.get(
              "words_cloud", {}
          )
          results.metrics["status"] = results.metrics[
              "status_distribution"
          ]
          results.metrics["predicted"] = results.metrics[
              "error_distribution"
          ]
          results.metrics["predicted"].pop("unknown", None)
  
      return results
  
imports: from typing import Iterable, List, Optional, Tuple
  from fastapi import Depends
  from argilla.server.errors.base_errors import EntityAlreadyExistsError, EntityNotFoundError, MissingDatasetRecordsError
  from argilla.server.services.datasets import DatasetsService
  from argilla.server.services.metrics import MetricsService
  from argilla.server.services.search.model import ServiceSearchResults, ServiceSortableField, ServiceSortConfig
  from argilla.server.services.search.service import SearchRecordsService
  from argilla.server.services.storage.service import RecordsStorageService
  from argilla.server.services.tasks.commons import BulkResponse
  from argilla.server.services.tasks.text_classification.metrics import TextClassificationMetrics
  from argilla.server.services.tasks.text_classification.model import DatasetLabelingRulesMetricsSummary, DatasetLabelingRulesSummary, LabelingRuleMetricsSummary, LabelingRuleSummary, ServiceLabelingRule, ServiceTextClassificationDataset, ServiceTextClassificationQuery, ServiceTextClassificationRecord
label_desc: Use image node_id 3 for calling the TextClassificationService obj's underlying member method code with example usage: obj.search(dataset, query, sort_by, record_from, size, exclude_metrics) and returns: results