Find answers from the community

Updated 2 months ago

does anyone know if I can merge 2 index

does anyone know if I can merge 2 index to be stored and retrieved? e.g.
Plain Text
existing_index = load_index_from_storage(storage_context, index_id=index_id)
documents = SimpleWebPageReader(html_to_text=True).load_data(websites.split(","))
new_index = VectorStoreIndex.from_documents(documents, service_context=service_context)
# merge(existing_index, new_index)
L
1 comment
you can't merge, but you could write a custom retriever that retrieves from two indexes

Small guide on custom retrievers here. It combines a keyword and vector index, but it could easily be two vector indexes https://gpt-index.readthedocs.io/en/latest/examples/query_engine/CustomRetrievers.html
Add a reply
Sign up and join the conversation on Discord