join is the matcher’s answer. See documents a matcher linked. The examples read settles, the matcher from match a payment to its invoice.
Declare the link
settles picked inv_2043 for two payments with their unmatched threshold false, so the invoice reads both. It does not read the payment whose pick crossed unmatched, or the one matched to a different invoice.
whenis required. A link exists only below one of the matcher’s thresholds, so the invoice reads only the picks below it.matchrepeats the matcher’sapplies_to.settlesmust answer each payment the relation reads, as for any relation that reads answers.settleskeeps no old answers. A judgment that reads blocks, and whose answers others read, needscreated_within: nulland nowherein its fan-out scope, or a reader can keep reading an old answer. Limitsettleswithapplies_toinstead.- Other answers on the payments. The relation can read the linked payments’ answers from other judgments, such as a
fraudthreshold infields. It reads nothing else ofsettles: itsvalueis the invoice itself, and its threshold is the link’s condition. - Booked payments. To also read the payments you recorded against the invoice, write the match to an attribute too, such as
attributes.settles, and declare a second relation on it:{"theirs": "attributes.settles", "mine": "id"}. The link reads the payments thatsettlespicked, and the second relation the ones you booked.
settles picked. See the document a match picked.
The invoice judgment reads settles, so it is at least the second level of a chain, whatever else it reads. An account judgment that reads the invoices’ answers is the third, and a portfolio can read the account.
Which payments link
A payment links to the invoice while all of these hold:- it agrees with the relation’s
match; - it has the same key as the invoice;
- the current answer of
settlesnames the invoice, withunmatchedfalse.
failed answer keeps its last pick, as any answer a relation reads does. A link ends at once when the payment leaves match (booked, deleted or outside applies_to), when its key changes, when settles picks another invoice, or when you change the threshold. The reconciliation write ends the link, because the payment leaves match.
When a fit with features changes a payment’s pick, the link moves to the new invoice, and both invoices are judged again, billed.
When the invoice is judged again
- A pick moves. When
settlesmoves a payment from one invoice to another, Brussle judges both. When it starts or stops a link, Brussle judges that invoice. A new answer that keeps the same pick causes nothing. - A linked payment changes. A write can change what the relation shows of the payment, whether it links, or its key. The invoice is
pendingfrom the moment Brussle acknowledges the write, and is judged again. - Another answer it reads changes. A change to another judgment’s answer on the payment judges again the invoice the payment links to now.
- A threshold of
settleschanges. You confirm it as for any threshold a reader names (see changing a threshold a reader reads), and Brussle judges again each invoice whose links it moves.
settles as child_pending under upstream. An invoice deleted and created again with the same id reads the payments whose answers name that id, and is judged again when settles judges those payments again.
What it costs
The invoice judgment is judged again for links that start, stop or switch (a switch judges two invoices), and for writes to linked payments that change what the relation shows. A payment whoseescape_p sits near the threshold can start and stop a link each time it is judged, with nothing changed. Keep the threshold away from where most of your escape_p values fall. The create response’s replay estimate counts each write to a payment the relation reads as one re-judge, and says "excludes": ["source_deletes"] for payments deleted in the window.
Limits and refused changes
block_cap. The invoice reads at most theblock_capofsettlesfrom its block. When the block holds more, the invoice is not judged again: it keeps its last answer and readsstale(limit_reached) until the block is back within the cap or you raise it. It never reads a partial list.- No reference index. A link does not use a reference index of its own.
settlesstays readable. While invoice judgments read through the link, Brussle refuses these changes tosettleswithconflict, naming the readers:- delete or deactivate it;
- give it a fan-out scope, or a policy other than
on_change; - remove the threshold that
whennames; - activate a version without
options.from, or whose candidates share a different key attribute.
- To change the key, delete the invoice judgments, activate the new version of
settles, and create the invoice judgments again.
What a link count measures
A matcher picks at most one candidate for each judged document, from thelast_n it reads: by default the newest in its block, or with relative the ones created nearest to it. The number of documents linked to a candidate says how often it was read and picked. What that means depends on the two sides:
- The same kind on both sides, such as duplicates or complaints matched to complaints. Each document reads the newest
last_nof its block, so the link count mostly measures how recent the candidate is, not how many similar records exist. To count similar records, use a group or an aggregate over a shared key. - Different kinds, with few candidates that seldom change, such as complaints matched to the service bulletins of one product. Each block holds no more than
last_ncandidates, so each judged document reads them all, unlesswindoworrelativeremoves some. The link count of a candidate is then the number of documents that picked it. Read it withaggregate: {"count": true}on the link.
Count the matches without a link
To know only how many documents matched any candidate, not which, count them on the document they point to: the payments of an account that settled any invoice, or the complaints about a vehicle that matched any bulletin. Use acount_where on the matcher’s value in a relation of the account’s judgment: