def create_node_from_result(
    result: Dict[str, Any], field_mapping: Dict[str, str]
) -> BaseNode:
    """
    Create a node from a search result.

    Args:
        result (Dict[str, Any]): Search result dictionary
        field_mapping (Dict[str, str]): Field mapping dictionary

    Returns:
        BaseNode: Created node

    """
    metadata_str = result[field_mapping["metadata"]]
    metadata = json.loads(metadata_str) if metadata_str else {}

    try:
        node = metadata_dict_to_node(metadata)
        node.set_content(result[field_mapping["chunk"]])
        node.embedding = result.get(field_mapping["embedding"])
    except Exception:
        # NOTE: deprecated legacy logic for backward compatibility
        metadata, node_info, relationships = legacy_metadata_dict_to_node(metadata)

        node = TextNode(
            text=result[field_mapping["chunk"]],
            id_=result[field_mapping["id"]],
            metadata=metadata,
            start_char_idx=node_info.get("start", None),
            end_char_idx=node_info.get("end", None),
            relationships=relationships,
        )
        if field_mapping.get("embedding"):
            node.embedding = result.get(field_mapping["embedding"])

    return node

    Create a node from a search result.

    Args:
        result (Dict[str, Any]): Search result dictionary
        field_mapping (Dict[str, str]): Field mapping dictionary

    Returns:
        BaseNode: Created node

    
llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/llama_index/vector_stores/azureaisearch/azureaisearch_utils.py