         check-all-done
         (fn []
           (if (and @ended (= @started @done))
-            (.endWriting idx)))
+            (do
+              (.endWriting idx)
+              (.sync rimraf (.join path (zest.docs.registry/get-so-root) "lucene"))
+              (.sync rimraf (.join path (zest.docs.registry/get-so-root) "leveldb"))
+              (.renameSync
+                (.join path (zest.docs.registry/get-so-root) "new_index" "lucene")
+                (.join path (zest.docs.registry/get-so-root) "lucene"))
+              (.renameSync
+                (.join path (zest.docs.registry/get-so-root) "new_index" "leveldb")
+                (.join path (zest.docs.registry/get-so-root) "leveldb")))))
 
         auf
         (fn [answer]

(def so-ul-speed (reagent/atom 0))
(def so-grep-progress (reagent/atom nil))
(def so-index-progress (reagent/atom nil))
(def so-archives-total (reagent/atom 0))
(def so-archives-available
  (let [fs (.require js/window "fs")

                                    (nth (.split line #"\s+") 3)))))))))
    ret))

(defn start-so-indexing []
  (reset! so-index-progress 0)
  (let [levelup (.require js/window "levelup")
        path (.require js/window "path")
        fs (.require js/window "fs")
        rimraf (.require js/window "rimraf")
        db (levelup.
             (.join path (zest.docs.registry/get-so-root) "new_index" "leveldb"))
        rStream (.createReadStream
                  db
                  (js-obj "gt" "p_"
