(Advanced) Rule Evaluation Order
This article explains in detail how MatchLogic evaluates Master Record Rules and Overwrite Rules internally. Understanding the evaluation model helps you design rule sets that produce predictable, correct golden records.
Master Record Rules: Win-Count Model
Master determination uses a win-count model across all active rules:
- For each active Master Record Rule, the system evaluates every record in the group against the rule's operation (Longest, Max, Most Popular, etc.).
- The record with the best value for that field is awarded one win.
- After all rules have run, each record in the group has a win count.
- The record with the highest win count is designated the master.
Example: You have five active Master Rules. Record A wins three of them (FirstName longest, Email present, City most popular). Record B wins two (LastName longest, Phone present). Record A becomes the master with 3 wins.
Tie-Breaking
When two records have equal win counts, the tiebreaker is record position within the group. The record that appears earliest (by original data source load order) wins the tie. To avoid relying on load order, add a deliberate tiebreaker rule — for example, a rule on a timestamp field using the Max operation to prefer the most recently updated record.
Rule Order Has No Effect on Win Counts
For Master Record Rules, the order of rules in the list does not affect the outcome. Each rule independently contributes one win to the tally. Changing rule order changes nothing about which record becomes master — only the number of active rules and their operations matter. See Activating and Ordering Rules for more.
Overwrite Rules: Sequential Evaluation
Overwrite Rules are evaluated in a strictly sequential, top-to-bottom pass. Each rule is independent:
- Rule 1 runs. If its condition is met, the master's field value is overwritten.
- Rule 2 runs. If its condition is met, it overwrites the value (potentially overwriting what Rule 1 just wrote).
- This continues for all active rules in order.
Rules Are Not Chained as Fallbacks
If Rule 1's condition is not met (e.g., Field Is Empty, but the field already has a value), Rule 1 is simply skipped. The system does NOT automatically move to Rule 2 as a fallback for the same field. Each rule is evaluated and applied (or not) independently.
Order Matters for Overwrite Rules
Unlike Master Rules, overwrite rule order does affect the final output. Consider this scenario:
- Rule 1 (top):
Emailfield — From Best Record, No Condition. Writes the best-scoring record's email. - Rule 2 (below):
Emailfield — From Master, Field Is Empty. Only writes the master's email if the field is empty.
Because Rule 1 runs first and always writes a value (No Condition), Rule 2's condition (Field Is Empty) is never met and Rule 2 has no effect. Reversing the order would change the outcome — Rule 2 would write the master's email if empty, and Rule 1 would then potentially overwrite it unconditionally.
Interaction Between Master and Overwrite Phases
The two execution phases are independent jobs:
- Master determination runs first and designates a master for each group.
- Overwrite rules then read those master designations and the current golden record values to apply field-level corrections.
If you re-run Master Rules (e.g., after modifying them), master designations may change. You should then re-run Overwrite Rules as well so that From Master and From Best Record operations reference the updated masters.
Data Source Filtering
Both rule types allow you to restrict which data sources participate in the evaluation. Records from excluded sources are not considered when calculating wins (Master Rules) or when sourcing overwrite values (Overwrite Rules). This effectively gives you per-source priority control without needing a separate rule per source combination.
Advanced Tip
To implement a strict source hierarchy (e.g., always prefer Source A over Source B over Source C), create separate rules per field that include only Source A with No Condition, then a second rule including only Source B with Field Is Empty as the condition. This builds an explicit fallback chain.