I create an
Indexnode
as follows:
indexnode = IndexNode.from_text_node(node, index_id=node.id_)
indexnode.id_ = str(uuid.uuid4())
indexnode.obj = node
Then, I use the following code:
from llama_index.core import StorageContext
storage_context = StorageContext.from_defaults()
index = VectorStoreIndex(
storage_context=storage_context,
objects=index_nodes,
)
index.set_index_id("index")
index.storage_context.docstore.add_documents(nodes)
index.storage_context.persist()
However, after running the above code,
index.storage_context.docstore.docs['xxxx'].obj
is None and cannot be restored by assignment.
This causes my Retriever to be unable to automatically enter into the textNode.
So what is the correct way to save an
IndexNode
with the
obj
attribute?