Ok, I found a way of reusing the data that is stored in my postgres to rebuild the
SimpleKeywordTableIndex
.
I use
pg_index_store.get_index_struct
to get the previous created data and feed it to
SimpleKeywordTableIndex
constructor.
storage_context = StorageContext.from_defaults(
docstore=pg_docstore,
vector_store=pg_vector_store,
index_store=pg_index_store,
)
index_struct = pg_index_store.get_index_struct("any-keyword-id") or KeywordTable(
index_id="any-keyword-id"
)
index = SimpleKeywordTableIndex(
index_struct=index_struct,
storage_context=storage_context,
)
print(len(index.as_retriever().retrieve("neon")))
Letting this here for anyone who's using the search in the future.
Thanks for your reply, Logan!