Skip to content

Commit 4132eed

Browse files
ryanjdewMarkLogic Builder
authored andcommitted
DHFPROD-7104: Fix calculated match activity recursion
1 parent f9029d8 commit 4132eed

File tree

2 files changed

+99
-2
lines changed

2 files changed

+99
-2
lines changed

marklogic-data-hub/src/main/resources/ml-modules/root/data-hub/5/data-services/mastering/calculateMatchingActivityLib.sjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function rulesetsCombosAboveScoreRecursion(
251251
} else {
252252
let results = [];
253253
remainingRulesets.forEach((ruleset, i) => {
254-
let subCombo = rulesetsCombosAtAndAboveScoreRecursion(
254+
let subCombo = rulesetsCombosAboveScoreRecursion(
255255
remainingRulesets.slice(i + 1),
256256
combinedWeight + ruleset.weight,
257257
score,

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/data-services/mastering/calculateMatchingActivity.sjs

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,103 @@ const expected1 =
382382
}
383383
;
384384

385+
const step2 = {
386+
"matchRulesets": [
387+
{
388+
"name": "customerId - Exact",
389+
"weight": 12,
390+
"matchRules": [
391+
{
392+
"entityPropertyPath": "customerId",
393+
"matchType": "exact",
394+
"options": {
395+
}
396+
}
397+
]
398+
}
399+
,
400+
{
401+
"name": "name - Exact",
402+
"weight": 16,
403+
"matchRules": [
404+
{
405+
"entityPropertyPath": "name",
406+
"matchType": "exact",
407+
"options": {
408+
}
409+
}
410+
]
411+
}
412+
,
413+
{
414+
"name": "birthDate - Reduce",
415+
"weight": 4,
416+
"reduce": true,
417+
"matchRules": [
418+
{
419+
"entityPropertyPath": "birthDate",
420+
"matchType": "exact",
421+
"options": {
422+
}
423+
}
424+
]
425+
}
426+
]
427+
,
428+
"thresholds": [
429+
{
430+
"thresholdName": "Definitive Match",
431+
"action": "merge",
432+
"score": 11
433+
}
434+
]
435+
};
436+
437+
const expected2 = {
438+
"scale":
439+
{
440+
"max": 11,
441+
"min": 11
442+
},
443+
"thresholdActions": [
444+
{
445+
"name": "Definitive Match",
446+
"action": "merge",
447+
"minimumMatchContributions": [
448+
[
449+
{
450+
"rulesetName": "name - Exact",
451+
"weight": 16,
452+
"matchRules": [
453+
{
454+
"entityPropertyPath": "name",
455+
"matchAlgorithm": "exact"
456+
}]
457+
}],
458+
[
459+
{
460+
"rulesetName": "customerId - Exact",
461+
"weight": 12,
462+
"matchRules": [
463+
{
464+
"entityPropertyPath": "customerId",
465+
"matchAlgorithm": "exact"
466+
}]
467+
},
468+
{
469+
"rulesetName": "NOT birthDate - Reduce",
470+
"weight": 4,
471+
"matchRules": [
472+
{
473+
"entityPropertyPath": "birthDate",
474+
"matchAlgorithm": "exact"
475+
}]
476+
}]
477+
]
478+
}]
479+
};
480+
385481
[
386-
test.assertEqualJson(expected1, cma.calculateMatchingActivity(step1), "most cases")
482+
test.assertEqualJson(expected1, cma.calculateMatchingActivity(step1), "most cases"),
483+
test.assertEqualJson(expected2, cma.calculateMatchingActivity(step2), "use case that hits reduce recursion code")
387484
];

0 commit comments

Comments
 (0)