SearchKit: How to update index after document was moved?

I'm writing a Swift wrapper for Search Kit and ran into a problem.

Let's say I have indexed a single document:
Code Block
/documents/hello.txt

Now the user moves the document to another folder:
Code Block
/notes/hello.txt

How can I update the index after a document was moved without having to re-index the document?

There is SKIndexMoveDocument(), but it requires a new parent SKDocument. How would I get a reference to that? I tried creating it via SKDocumentCreateWithURL, but updating the index fails. I assume, because there is no document with the path "/notes/" in the index (it's a folder after all)?

The SearchKit Programming Guide says that when moving a document, one should remove the old document from the index and add it again with the new URL.

There has to be a better way without having to reindex. Imagine renaming the root folder of a large document tree. Re-indexing all files would be unnecessary if only their URLs changed.



SearchKit: How to update index after document was moved?
 
 
Q