code: def serialize_search(self, pid_fetcher, search_result, links=None,
                           item_links_factory=None):
          
          records = []
          for hit in search_result['hits']['hits']:
              records.append(self.schema.tostring(self.transform_search_hit(
                  pid_fetcher(hit['_id'], hit['_source']),
                  hit,
                  links_factory=item_links_factory,
              )))
  
          return "\n".join(records)
docs: Serialize a search result.
  
          :param pid_fetcher: Persistent identifier fetcher.
          :param search_result: Elasticsearch search result.
          :param links: Dictionary of links to add to response.