Skip to content

Commit c716ab9

Browse files
ryanjdewMarkLogic Builder
authored andcommitted
DHFPROD-7995: Don't allow null/empty values to count toward matching score
1 parent c3189f4 commit c716ab9

File tree

7 files changed

+302
-188
lines changed

7 files changed

+302
-188
lines changed

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.smart-mastering/matcher-impl/matcher-impl.xqy

Lines changed: 196 additions & 187 deletions
Large diffs are not rendered by default.

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/smart-mastering/entity-driven/entityDrivenMatches.sjs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ function testNamespacedXmlMatches() {
4343
const results = fn.head(match.main(content, { stepId: 'matchNamespacedCustomers-matching'})).value;
4444
return verifyResults(content, results);
4545
}
46+
47+
function verifyNullsDoNotMatch() {
48+
const content = hubUtils.queryToContentDescriptorArray(cts.documentQuery('/content/CustNonMatchNull.json'), {}, xdmp.databaseName(xdmp.database()));
49+
const results = fn.head(match.main(content, { stepId: 'matchCustomers-matching'})).value;
50+
let resultsNode = xdmp.toJSON(results);
51+
let mergeAction = resultsNode.xpath('matchSummary/actionDetails/*[action = "merge"]');
52+
let customAction = resultsNode.xpath('matchSummary/actionDetails/*[action = "customActions"]');
53+
let notifyAction = resultsNode.xpath('matchSummary/actionDetails/*[action = "notify"]');
54+
return [
55+
test.assertEqual(1, fn.count(results), `A matchSummary should be returned. Results: ${results}`),
56+
test.assertEqual(0, fn.count(mergeAction), `Zero merge actions should be in the matchSummary. Results: ${xdmp.toJsonString(results)}`),
57+
test.assertEqual(0, fn.count(customAction), `Zero custom actions should be in the matchSummary. Results: ${xdmp.toJsonString(results)}`),
58+
test.assertEqual(0, fn.count(notifyAction), `Zero notify actions should be in the matchSummary. Results: ${xdmp.toJsonString(results)}`)
59+
];
60+
}
4661
assertions
4762
.concat(testJsonMatches())
48-
.concat(testNamespacedXmlMatches());
63+
.concat(testNamespacedXmlMatches())
64+
.concat(verifyNullsDoNotMatch());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"envelope": {
3+
"headers": {
4+
"sources": [
5+
{
6+
"name": "source 2"
7+
}
8+
],
9+
"createdOn": "2020-08-20T05:27:43.360675Z",
10+
"createdBy": "admin"
11+
},
12+
"triples": [],
13+
"instance": {
14+
"info": {
15+
"title": "Customer",
16+
"version": "0.0.1",
17+
"baseUri": "http://example.org/"
18+
},
19+
"Customer": {
20+
"customerId": 3243,
21+
"name": null,
22+
"birthDate": "1985-01-01",
23+
"shipping": [
24+
{
25+
"Address": {
26+
"street": [
27+
"Hanover Place"
28+
],
29+
"city": null,
30+
"state": "Oklahoma",
31+
"zip": {
32+
"Zip": {
33+
"fiveDigit": null,
34+
"plusFour": "1001"
35+
}
36+
}
37+
}
38+
},
39+
{
40+
"Address": {
41+
"street": [
42+
"1800 Tysons Blvd"
43+
],
44+
"city": null,
45+
"state": "Virginia",
46+
"zip": {
47+
"Zip": {
48+
"fiveDigit": null,
49+
"plusFour": "2021"
50+
}
51+
}
52+
}
53+
}
54+
],
55+
"billing": {
56+
"Address": {
57+
"street": [
58+
"Sunnyside Avenue"
59+
],
60+
"city": null,
61+
"state": "Wisconsin",
62+
"zip": {
63+
"Zip": {
64+
"fiveDigit": null,
65+
"plusFour": "8854"
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
73+
}

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/smart-mastering/entity-driven/test-data/steps/matching/matchCustomerBillingCityState.step.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
{
2727
"entityPropertyPath": "billing.state",
2828
"matchType": "exact"
29+
},
30+
{
31+
"entityPropertyPath": "billing.zip.fiveDigit",
32+
"matchType": "exact"
2933
}
3034
]
3135
}

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/smart-mastering/entity-driven/test-data/steps/matching/matchCustomerShippingCityState.step.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
{
2727
"entityPropertyPath": "shipping.state",
2828
"matchType": "exact"
29+
},
30+
{
31+
"entityPropertyPath": "shipping.zip.fiveDigit",
32+
"matchType": "exact"
2933
}
3034
]
3135
}

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/smart-mastering/entity-driven/test-data/steps/matching/matchNSCustomerBillingCityState.step.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
{
2727
"entityPropertyPath": "billing.state",
2828
"matchType": "exact"
29+
},
30+
{
31+
"entityPropertyPath": "billing.zip.fiveDigit",
32+
"matchType": "exact"
2933
}
3034
]
3135
}

marklogic-data-hub/src/test/ml-modules/root/test/suites/data-hub/5/smart-mastering/entity-driven/test-data/steps/matching/matchNSCustomerShippingCityState.step.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
{
2727
"entityPropertyPath": "shipping.state",
2828
"matchType": "exact"
29+
},
30+
{
31+
"entityPropertyPath": "shipping.zip.fiveDigit",
32+
"matchType": "exact"
2933
}
3034
]
3135
}

0 commit comments

Comments
 (0)