pub fn merge_segments(
base: &Path,
inputs: &[&Segment],
new_id: &str,
) -> Result<SegmentMeta, String>Expand description
Merge segments into one, applying their tombstones.
This is the operation the format was shaped for: every segment’s dimension table is sorted by global token id, so the merge walks the tables together and concatenates the posting lists of the same token — nothing is remapped, no id is rewritten, and no dictionary is rebuilt. Merging two indexes is the same call with their segments as input, which is why segments, index fusion and delta sync are one mechanism and not three.
Within a token, entries stay sorted by record id and the newest segment wins a tie — a document updated in a later segment already had its older copy tombstoned, so a tie only happens between a segment and itself.