@natlibfi/melinda-record-matching 4.1.1 → 4.1.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/candidate-search/candidate-search-utils.js.map +1 -1
- package/dist/candidate-search/index.js +1 -1
- package/dist/candidate-search/index.js.map +1 -1
- package/dist/candidate-search/index.spec.js +2 -2
- package/dist/candidate-search/index.spec.js.map +1 -1
- package/dist/candidate-search/query-list/bib.js.map +1 -1
- package/dist/candidate-search/query-list/bib.spec.js.map +1 -1
- package/dist/candidate-search/query-list/index.js.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.spec.js +9 -9
- package/dist/index.spec.js.map +1 -1
- package/dist/match-detection/features/bib/all-source-ids.js.map +1 -1
- package/dist/match-detection/features/bib/authors.js.map +1 -1
- package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -1
- package/dist/match-detection/features/bib/host-component.js.map +1 -1
- package/dist/match-detection/features/bib/index.js.map +1 -1
- package/dist/match-detection/features/bib/index.spec.js.map +1 -1
- package/dist/match-detection/features/bib/isbn.js.map +1 -1
- package/dist/match-detection/features/bib/issn.js.map +1 -1
- package/dist/match-detection/features/bib/language.js.map +1 -1
- package/dist/match-detection/features/bib/melinda-id.js.map +1 -1
- package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -1
- package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time.js.map +1 -1
- package/dist/match-detection/features/bib/record-type.js.map +1 -1
- package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -1
- package/dist/match-detection/features/bib/title-version-original.js.map +1 -1
- package/dist/match-detection/features/bib/title.js.map +1 -1
- package/dist/match-detection/features/index.js.map +1 -1
- package/dist/match-detection/index.js.map +1 -1
- package/dist/match-detection/index.spec.js.map +1 -1
- package/dist/matching-utils.js.map +1 -1
- package/package.json +15 -15
- package/src/candidate-search/index.js +1 -1
- package/src/candidate-search/index.spec.js +2 -2
- package/src/index.js +5 -5
- package/src/index.spec.js +6 -9
|
@@ -119,7 +119,7 @@ export default ({record, searchSpec, url, maxCandidates, maxRecordsPerRequest =
|
|
|
119
119
|
|
|
120
120
|
client.searchRetrieve(query, {startRecord: resultSetOffset})
|
|
121
121
|
.on('error', err => {
|
|
122
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
122
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
123
123
|
if (err instanceof SruSearchError) {
|
|
124
124
|
debug(`SRU SruSearchError for query: ${query}: ${err}`);
|
|
125
125
|
reject(new CandidateSearchError(`SRU SruSearchError for query: ${query}: ${err}`));
|
|
@@ -79,7 +79,7 @@ describe('candidate-search', () => {
|
|
|
79
79
|
async function iterate({searchOptions, expectedSearchError, expectedErrorStatus, count = 1}) {
|
|
80
80
|
const expectedResults = getFixture(`expectedResults${count}.json`);
|
|
81
81
|
|
|
82
|
-
if (expectedSearchError) { // eslint-disable-line functional/no-conditional-
|
|
82
|
+
if (expectedSearchError) { // eslint-disable-line functional/no-conditional-statements
|
|
83
83
|
try {
|
|
84
84
|
await search(searchOptions);
|
|
85
85
|
throw new Error('Expected an error');
|
|
@@ -99,7 +99,7 @@ describe('candidate-search', () => {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
102
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
103
103
|
if (!expectedSearchError) {
|
|
104
104
|
const results = await search(searchOptions);
|
|
105
105
|
expect(formatResults(results)).to.eql(expectedResults);
|
package/src/index.js
CHANGED
|
@@ -113,7 +113,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
|
|
|
113
113
|
|
|
114
114
|
function handleMatchResult(matchResult, matches, nonMatches, matchErrors) {
|
|
115
115
|
debugData(`- Amount of new matches from record set: ${matchResult.matches.length}`);
|
|
116
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
116
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
117
117
|
if (returnNonMatches) {
|
|
118
118
|
debugData(`- Amount of new nonMatches from record set: ${matchResult.nonMatches.length}`);
|
|
119
119
|
}
|
|
@@ -123,7 +123,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
|
|
|
123
123
|
const newMatchErrors = matchErrors.concat(matchResult.matchErrors);
|
|
124
124
|
|
|
125
125
|
debugData(`- Total amount of matches: ${newMatches.length}`);
|
|
126
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
126
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
127
127
|
if (returnNonMatches) {
|
|
128
128
|
debugData(`- Total amount of nonMatches: ${newNonMatches.length}`);
|
|
129
129
|
}
|
|
@@ -173,7 +173,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
|
|
|
173
173
|
checkCounts({matches, nonMatches, candidateCount, duplicateCount, nonMatchCount, conversionFailureCount, matchErrorCount});
|
|
174
174
|
const matchStatus = getMatchState(state, stopReason, conversionFailureCount, matchErrorCount);
|
|
175
175
|
// add nonMatches to result only if returnNonMatches is 'true', otherwise nonMatches have not been gathered
|
|
176
|
-
const matchesResult = returnNonMatches ? {matches, matchStatus, nonMatches} : {matches, matchStatus};
|
|
176
|
+
const matchesResult = returnNonMatches ? {matches, matchStatus, nonMatches, candidateCount} : {matches, matchStatus, candidateCount};
|
|
177
177
|
const failures = [...conversionFailures, ...matchErrors];
|
|
178
178
|
const result = returnFailures ? {...matchesResult, conversionFailures: failures} : matchesResult;
|
|
179
179
|
debugData(`ReturnFailures ${returnFailures}`);
|
|
@@ -267,7 +267,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
|
|
|
267
267
|
|
|
268
268
|
if (candidate) {
|
|
269
269
|
|
|
270
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
270
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
271
271
|
if (candidateNotInMatches(matches.concat(nonMatches), candidate)) {
|
|
272
272
|
const {record: candidateRecord, id: candidateId} = candidate;
|
|
273
273
|
const recordBExternal = {id: candidate.id, recordSource: 'databaseRecord', label: `db-${candidate.id}`};
|
|
@@ -330,7 +330,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
|
|
|
330
330
|
|
|
331
331
|
debugData(`- Total matches after this detection: ${matches.concat(newRecordMatches).length} (max: ${maxMatches})`);
|
|
332
332
|
|
|
333
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
333
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
334
334
|
if (returnNonMatches) {
|
|
335
335
|
debugData(`- Total nonMatches after this detection: ${nonMatches.concat(newRecordNonMatches).length}`);
|
|
336
336
|
}
|
package/src/index.spec.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Melinda record matching modules for Javascript
|
|
6
6
|
*
|
|
7
|
-
* Copyright (C) 2020-
|
|
7
|
+
* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)
|
|
8
8
|
*
|
|
9
9
|
* This file is part of melinda-record-matching-js
|
|
10
10
|
*
|
|
@@ -46,12 +46,8 @@ describe('INDEX', () => {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!enabled) {
|
|
52
|
-
debug(`Disabled test!`);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
49
|
+
// eslint-disable-next-line max-statements
|
|
50
|
+
async function callback({getFixture, options, expectedMatchStatus, expectedStopReason, expectedFailures, expectedCandidateCount}) {
|
|
55
51
|
|
|
56
52
|
const record = new MarcRecord(getFixture('inputRecord.json'), {subfieldValues: false});
|
|
57
53
|
const expectedMatches = getFixture('expectedMatches.json');
|
|
@@ -59,11 +55,12 @@ describe('INDEX', () => {
|
|
|
59
55
|
|
|
60
56
|
|
|
61
57
|
const match = createMatchInterface(formatOptions());
|
|
62
|
-
const {matches, matchStatus, nonMatches, conversionFailures} = await match({record});
|
|
58
|
+
const {matches, matchStatus, nonMatches, conversionFailures, candidateCount} = await match({record});
|
|
63
59
|
debugData(`Matches: ${matches.length}, Status: ${matchStatus.status}/${matchStatus.stopReason}, NonMatches: ${nonMatches ? nonMatches.length : 'not returned'}, ConversionFailures: ${conversionFailures ? conversionFailures.length : 'not returned'}`);
|
|
64
60
|
|
|
65
61
|
expect(matchStatus.status).to.eql(expectedMatchStatus);
|
|
66
62
|
expect(matchStatus.stopReason).to.eql(expectedStopReason);
|
|
63
|
+
expect(candidateCount).to.eql(expectedCandidateCount);
|
|
67
64
|
|
|
68
65
|
const formattedMatchResult = formatRecordResults(matches);
|
|
69
66
|
expect(formattedMatchResult).to.eql(expectedMatches);
|
|
@@ -71,7 +68,7 @@ describe('INDEX', () => {
|
|
|
71
68
|
const formattedNonMatchResult = formatRecordResults(nonMatches);
|
|
72
69
|
expect(formattedNonMatchResult).to.eql(expectedNonMatches);
|
|
73
70
|
|
|
74
|
-
// eslint-disable-next-line functional/no-conditional-
|
|
71
|
+
// eslint-disable-next-line functional/no-conditional-statements
|
|
75
72
|
if (expectedFailures) {
|
|
76
73
|
expect(conversionFailures).to.eql(expectedFailures);
|
|
77
74
|
}
|