Rebuild the index store wholesale from the record store.
Everything the index holds — the trie, the secondary roots, the rule index, the exception re-check index, the inverted term index — is derived from the stored sentexes, so the repair for a damaged or stale index is mechanical: clear it and re-derive every entry. Three situations need it:
assert spans both
stores; each side is a single pipeline, but the seam between them remains)
— the orphaned record is unfindable, and re-asserting its sentence
would mint a second handle for the same canonical form;Run core/recover afterwards: it rebuilds the TMS and taxonomy from the
stores, and parts of that rebuild (rebuild-taxonomy reads the functor root)
read the very index this restores.
Named bare, like recover: the ! convention marks destruction of stored
knowledge, and this destroys only derived state and recreates it from the
records, which stay untouched.
Rebuild the index store wholesale from the record store. Everything the index holds — the trie, the secondary roots, the rule index, the exception re-check index, the inverted term index — is *derived* from the stored sentexes, so the repair for a damaged or stale index is mechanical: clear it and re-derive every entry. Three situations need it: * a crash between the record write and the index pipeline (`assert` spans both stores; each side is a single pipeline, but the seam between them remains) — the orphaned record is unfindable, and re-asserting its sentence would mint a *second* handle for the same canonical form; * an index layout change (the leaf/child key split makes an index written in the old shape read as empty — fail-safe, but a persistent KB needs this rebuild); * any suspicion that counts and extents have drifted: a rebuild is cheaper than an audit. Run `core/recover` afterwards: it rebuilds the TMS and taxonomy from the stores, and parts of that rebuild (`rebuild-taxonomy` reads the functor root) read the very index this restores. Named bare, like `recover`: the `!` convention marks destruction of stored *knowledge*, and this destroys only derived state and recreates it from the records, which stay untouched.
(index-one! index sx h)Index one stored sentex sx at handle h into index: its positional / term / root
entry (index-sentex), plus — when sx is a rule — the rule-predicate entry, or — when
it is an exceptWhen meta-sentex — the exception entry. This is the per-sentex core
reindex folds over every live handle, and the core the importer's inline bulk load
calls with the record already in hand, so a rebuilt index and a freshly-loaded one can
never drift. Returns true iff sx is a rule (the caller's rule tally).
Index one stored sentex `sx` at handle `h` into `index`: its positional / term / root entry (`index-sentex`), plus — when `sx` is a rule — the rule-predicate entry, or — when it is an `exceptWhen` meta-sentex — the exception entry. This is the per-sentex core `reindex` folds over every live handle, *and* the core the importer's inline bulk load calls with the record already in hand, so a rebuilt index and a freshly-loaded one can never drift. Returns true iff `sx` is a rule (the caller's rule tally).
(reindex kb)Flush the index store and rebuild every entry from the stored sentexes. Returns {:sentexes n :rules n}.
Flush the index store and rebuild every entry from the stored sentexes.
Returns {:sentexes n :rules n}.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |