interface Progress Never called concurrently, and never after the call it was passed to is final.
It must not throw; an exception escaping it terminates the process.
Ask your coding agent about this page, or add the docs server to it
curl -s 'https://www.unum.cloud/docs/usearch/java/filtered-search.md' | claude -p "How would this fit my code?"A java.util.function.Predicate<Key> on the search, multiply, attention and MaxSim configs decides which candidate keys a walk may report, and a Progress on every long verb hears its advance and cancels it by answering false, which the call reports as Status.CANCELLED.
An insertion is all-or-nothing, so its progress handler cannot cancel it.
Each runs as an upcall straight into your object, the predicate on the executor’s threads together and the progress handler never concurrently.
Neither may throw: an exception escaping a callback terminates the process.
A Predicate<Key> answers one key at a time, asked as candidates are scored, while a BatchPredicate answers an array of keys into an array of admissions, each starting as false, and is asked once per traversal round, for a handler that pays per call, such as a lookup in an external database. predicate(batch, PredicateCost.CHEAP) asks it as candidates arrive instead.
DenseSearchConfig filtered = new DenseSearchConfig(10).predicate(key -> allowed.contains(key));
DenseSearchConfig looked = new DenseSearchConfig(10).predicate((keys, admissions) -> database.admit(keys, admissions));
DenseSearchConfig watched = new DenseSearchConfig(10).progress((completed, total) -> !cancelRequested());
index.save("index.safegraphs", (completed, total) -> { bar.set(completed, total); return true; });ProgressHears how far a long call has advanced, in whatever units it consumes, and decides whether it goes on.interface Progress Never called concurrently, and never after the call it was passed to is final.
It must not throw; an exception escaping it terminates the process.
PhaseProgressWhere a plan stands once a call naming it returned.record PhaseProgress(
Phase phase,
long ordinal,
long completed,
long total); phase | the kind of work in hand. | |
|---|---|---|
ordinal | this phase's position among the ones the plan runs. | |
completed | units of this phase done, entries or islands. | |
total | units of this phase in all. |