class_docstr: Ranks Documents based on the value of their specific meta field.
  The ranking can be performed in descending order or ascending order.
  
  Usage example:
  ```
  from haystack import Document
  from haystack.components.rankers import MetaFieldRanker
  
  ranker = MetaFieldRanker(meta_field="rating")
  docs = [
      Document(text="Paris", meta={"rating": 1.3}),
      Document(text="Berlin", meta={"rating": 0.7}),
      Document(text="Barcelona", meta={"rating": 2.1}),
  ]
  
  output = ranker.run(documents=docs)
  docs = output["documents"]
  assert docs[0].text == "Barcelona"
docstr: Serialize object to a dictionary.
code: def to_dict(self) -> Dict[str, Any]:
      """
      Serialize object to a dictionary.
      """
      return default_to_dict(
          self,
          meta_field=self.meta_field,
          weight=self.weight,
          top_k=self.top_k,
          ranking_mode=self.ranking_mode,
          sort_order=self.sort_order,
      )
  
file_path: haystack/haystack/components/rankers/meta_field.py
imports: import logging
  from collections import defaultdict
  from typing import List, Dict, Any, Optional, Literal
  from haystack import Document, component, default_to_dict
label_desc: Use image node_id 3 for calling the MetaFieldRanker obj's underlying member method code with example usage: obj.to_dict() and returns: default_to_dict