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: Merge the two different rankings for Documents sorted both by their content and by their meta field.
code: def _merge_rankings(
      self, documents: List[Document], sorted_documents: List[Document]
  ) -> List[Document]:
      """
      Merge the two different rankings for Documents sorted both by their content and by their meta field.
      """
      scores_map: Dict = defaultdict(int)
  
      if self.ranking_mode == "reciprocal_rank_fusion":
          for i, (document, sorted_doc) in enumerate(
              zip(documents, sorted_documents)
          ):
              scores_map[document.id] += self._calculate_rrf(rank=i) * (
                  1 - self.weight
              )
              scores_map[sorted_doc.id] += (
                  self._calculate_rrf(rank=i) * self.weight
              )
      elif self.ranking_mode == "linear_score":
          for i, (document, sorted_doc) in enumerate(
              zip(documents, sorted_documents)
          ):
              score = float(0)
              if document.score is None:
                  logger.warning(
                      "The score wasn't provided; defaulting to 0."
                  )
              elif document.score < 0 or document.score > 1:
                  logger.warning(
                      "The score %s for Document %s is outside the [0,1] range; defaulting to 0",
                      document.score,
                      document.id,
                  )
              else:
                  score = document.score
  
              scores_map[document.id] += score * (1 - self.weight)
              scores_map[sorted_doc.id] += (
                  self._calc_linear_score(
                      rank=i, amount=len(sorted_documents)
                  )
                  * self.weight
              )
  
      for document in documents:
          document.score = scores_map[document.id]
  
      new_sorted_documents = sorted(
          documents,
          key=lambda doc: doc.score if doc.score else -1,
          reverse=True,
      )
      return new_sorted_documents
  
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 5 for calling the MetaFieldRanker obj's underlying member method code with example usage: obj._merge_rankings(documents, sorted_documents) and returns: new_sorted_documents