Rust · Refinement

Refinement

use usearch::DenseAbsorbConfig;use usearch::DenseRefineConfig;use usearch::DenseSplitConfig;use usearch::RefineReport; 3.0.0-rc.1 · 4c3e5023

refine re-runs the neighbor selection over entries already in the graph and returns a RefineReport of the nodes re-selected, those whose neighbors changed, the islands found and reconnected, and the reachability audit closing the heal, so a batch built at a low expansion factor reaches the quality of a slower build afterwards. changed reaching zero is what settled looks like. On a RAM handle searches may run throughout, on a VRAM one they may not, and insertions never may.

let receiver = index.on(&executor);
while receiver.refine(DenseRefineConfig { expansion_factor: 128, ..DenseRefineConfig::default() })?.changed != 0 {}

§ Absorbing & Splitting

absorb takes donor indexes, handed over by value, one after another, keeping their graphs rather than re-inserting their entries and linking each in by walks across the appended part. Readers of a RAM index may keep searching throughout, while a VRAM one admits no overlapping search.

index.on(&executor).absorb([first_shard, second_shard])?;
index.on(&executor).split(&[&left, &right][..])?; // two empty receivers take a part each

A stopped absorb cuts only its closing refinement, every donor already moved, and reports Status::Cancelled. split is its inverse, leaving the source empty and live; both answer a RefineReport.

API

StructDenseAbsorbConfigThe donors an absorb consumes and the handler counting them; see DenseVerbs::absorb.
dense_index.rs:1103 ↗
pub struct DenseAbsorbConfig<'config, Donors>

Fields

donorsDonorsThe indexes absorbed, consumed whether or not the absorb succeeds.
progressOption<&'config mut ProgressCallback<'config>>Reports the nodes the closing refinement re-selected and stops it wherever it says to.
progress_stepsusizeReports the call makes at most, the last at completion; zero derives to ten.

Implements

From<Donors>
StructDenseRefineConfigThe knobs of DenseVerbs::refine.
dense_index.rs:966 ↗
pub struct DenseRefineConfig<'config>

Fields

expansion_factorusizeThe breadth of the candidates the walk explores; zero derives it from the geometry.
progressOption<&'config mut ProgressCallback<'config>>Reports the nodes swept and stops wherever it says to.
progress_stepsusizeReports the call makes at most, the last at completion; zero derives to ten.
statsOption<&'config mut DenseTraversalStats>Where the traversal telemetry lands, overwritten by the call.

Implements

Default
StructDenseSplitConfigThe receivers a split fills and the knobs of its closing refinements; see DenseVerbs::split.
dense_index.rs:1113 ↗
pub struct DenseSplitConfig<'config>

Fields

receivers&'config [&'config DenseIndex]At least two empty indexes of the source's residency, scalar, class, metric, geometry and shard count, each receiving one part.
expansion_factorusizeThe breadth of the closing refinements' walks; zero derives it from the geometry.
seedu64Picks the part roots: equal seeds over an unchanged index split equally.
progressOption<&'config mut ProgressCallback<'config>>Reports the nodes the closing refinements re-selected and stops them wherever it says to.
progress_stepsusizeReports the call makes at most, the last at completion; zero derives to ten.
statsOption<&'config mut DenseTraversalStats>Where the traversal telemetry lands, overwritten by the call.

Implements

From<&'config [&'config DenseIndex]>
StructRefineReportWhat one refine-family call did to the graph: DenseVerbs::refine, DenseVerbs::absorb and DenseVerbs::split land it.
dense_index.rs:739 ↗
pub struct RefineReport

Fields

reselectedusizeEntries whose neighbors were selected again, the islands of every heal round included.
changedusizeOf those, the entries whose neighbor set gained a member it lacked; never above reselected.
islands_foundusizeEntries the first audit found not reached both ways, counted once.
islands_reconnectedusizeLinks written between an island and an entry the audit reached both ways.
reachabilityDenseReachabilityThe audit closing the heal, as a fresh DenseVerbs::health right after would take it.

Implements

Clone, Copy, StructuralPartialEq, PartialEq, Eq, Debug, Default