From 79d5ca9edcf4e590656fefd425c57fdac71db067 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 2 Apr 2024 14:01:26 -0400 Subject: [PATCH 01/16] Update onsite-edd critiera to match sheet Update onsite-edd criteria to match location critiera in: https://docs.google.com/spreadsheets/d/1fTZlmvT39Yk3ZAeYR2qNNwIUIhWhBY1XpOUPaYTeOL8 - Spreadsheet removed maff1, magg1, magh1, maii1, mall1, mapp1, & scff1 in Aug 2021 - Spreadsheet has myh22 (pah22) and mym22 (pam22), so adding those. --- data/onsite-edd-criteria.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/data/onsite-edd-criteria.json b/data/onsite-edd-criteria.json index 233ed669..21ff7b04 100644 --- a/data/onsite-edd-criteria.json +++ b/data/onsite-edd-criteria.json @@ -34,19 +34,15 @@ "maf", "maf82", "maf92", - "maff1", "maff3", "mag", "mag82", "mag92", - "magg1", "magg2", "magg3", - "magh1", "mai", "mai82", "mai92", - "maii1", "maii2", "maii3", "maj92", @@ -57,13 +53,11 @@ "mal72", "mal82", "mal92", - "mall1", "malm2", "malv2", "map", "map82", "map92", - "mapp1", "mapp2", "mapp3", "mas62", @@ -71,7 +65,9 @@ "mas92", "pad22", "pad32", + "pam22", "pah", + "pah22", "pah32", "pam", "pam32", @@ -80,7 +76,6 @@ "pat22", "pat32", "scf", - "scff1", "scff2", "scff3" ] From ac14074eef08300a77ca80ee7b42786545337203 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 2 Apr 2024 14:09:34 -0400 Subject: [PATCH 02/16] Fix onsite requestability test --- test/delivery-locations-resolver.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/delivery-locations-resolver.test.js b/test/delivery-locations-resolver.test.js index 957f92b2..e93b312c 100644 --- a/test/delivery-locations-resolver.test.js +++ b/test/delivery-locations-resolver.test.js @@ -44,7 +44,7 @@ var sampleItems = { 'uri': 'i12227153', 'holdingLocation': [ { - 'id': 'loc:scff1', + 'id': 'loc:scf', 'label': 'Schomburg Center - Research & Reference' } ], From 63fe6c7507d57c4ea4de42167b456822325e02f5 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 9 Apr 2024 14:19:39 -0400 Subject: [PATCH 03/16] Trivial --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 855e2e41..0870f000 100644 --- a/README.md +++ b/README.md @@ -242,3 +242,4 @@ There is currently one feature flag in this app, which is 'no-on-site-edd'. When NB: numAvailable and numItem*Parsed counts do not **exclude** the e-item, but these items are not indexed with statuses, volumes, or date ranges, and are therefore not actually included in this count. NB: As the table above indicates, there is a mismatch between what the front end and API regard as "electronic items". As far as the API is concerned, there is only at most ONE electronic item, which can have many electronic locator values. `numElectronicResources` counts these locator values, but the other item count values treat all the electronic resources as a single item. + From 9e9e999784293d2000ea379d7f89971ea3fa1439 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 16 Apr 2024 10:07:30 -0400 Subject: [PATCH 04/16] Update to use newly prod-refreshed qa index --- config/qa.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/qa.env b/config/qa.env index ae67cbb4..92722271 100644 --- a/config/qa.env +++ b/config/qa.env @@ -1,7 +1,7 @@ SCSB_URL=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIAwfgYJKoZIhvcNAQcGoHEwbwIBADBqBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDIvu80tR1bouRiOs6QIBEIA9GApMl/PyhgJ5DepSzd2LFF2M9o/8xh+k2CXbCskhhK/DTCpIcSmGEzaqvItktPRMaUd0xKTeBLph0cZDMw== SCSB_API_KEY=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGMwYQYJKoZIhvcNAQcGoFQwUgIBADBNBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDBGj6VVDSTYYcLzAdgIBEIAgOtoxPpUgkHHgc3eipZzyfMEUwYHIt7VvXy9Y5GRkVik= ELASTICSEARCH_HOST=search-discovery-api-qa-exfqovqmh54mbkqr7cwk4awaqe.us-east-1.es.amazonaws.com -RESOURCES_INDEX=resources-2020-05-08 +RESOURCES_INDEX=resources-2024-04-15 NYPL_OAUTH_URL=https://isso.nypl.org/ NYPL_OAUTH_ID=discovery_api NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAzRXNLpvMidP4TSJpsCARCAQxDNmJ+FgXuUocplZf15XlbC/quzjPHW+U8Zkv+TkukXs7YThqmTYWoXv34KVeymHcR3Gi5nkTpFuTAKiYRWDNeEaWA= From b4eca43cd8b41272f1d9c3384f2606874aaed9cd Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 16 Apr 2024 11:12:46 -0400 Subject: [PATCH 05/16] Create CODEOWNERS (test) --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..a16d9949 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @NYPL/lsp-write-access From 9cc1143a3bba44ec612ca2589f9958c8aefab658 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 16 Apr 2024 11:16:33 -0400 Subject: [PATCH 06/16] Update CODEOWNERS --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a16d9949..82ca755a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ -* @NYPL/lsp-write-access +# * @NYPL/lsp-write-access +* @nonword @danamansana @charmingduchess From a8c889f9fd71c04295ab65d836ceec8790e50802 Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Tue, 16 Apr 2024 13:00:20 -0400 Subject: [PATCH 07/16] Update CODEOWNERS --- .github/CODEOWNERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 82ca755a..a16d9949 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1 @@ -# * @NYPL/lsp-write-access -* @nonword @danamansana @charmingduchess +* @NYPL/lsp-write-access From cf48206118ac15ab4ac107e8a3a8ff3b38f4538f Mon Sep 17 00:00:00 2001 From: Paul Beaudoin Date: Wed, 17 Apr 2024 10:39:03 -0400 Subject: [PATCH 08/16] Remove CODEOWNERS until we can discuss use --- .github/CODEOWNERS | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index a16d9949..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @NYPL/lsp-write-access From 4b6a6312eae5e72a1aaad470536c9ddebf0b52fe Mon Sep 17 00:00:00 2001 From: danamansana Date: Tue, 14 May 2024 15:07:45 -0400 Subject: [PATCH 09/16] Add making eddRequestable false in case no recapCustomerCode and holding location not requestable --- lib/delivery-locations-resolver.js | 6 +++++- lib/requestability_resolver.js | 11 +++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/delivery-locations-resolver.js b/lib/delivery-locations-resolver.js index 5a731fb4..864f1939 100644 --- a/lib/delivery-locations-resolver.js +++ b/lib/delivery-locations-resolver.js @@ -236,7 +236,11 @@ class DeliveryLocationsResolver { // location is not requestable: let deliveryLocation let eddRequestable - if (!isItemNyplOwned(item) || this.requestableBasedOnHoldingLocation(item)) { + const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0] + if (!hasRecapCustomerCode) { + deliveryLocation = [''] + eddRequestable = this.requestableBasedOnHoldingLocation(item) + } else if (!isItemNyplOwned(item) || this.requestableBasedOnHoldingLocation(item)) { deliveryLocation = this.deliveryLocationsByRecapCustomerCode(item.recapCustomerCode[0]) eddRequestable = this.__eddRequestableByCustomerCode(item.recapCustomerCode[0]) } else { diff --git a/lib/requestability_resolver.js b/lib/requestability_resolver.js index 52b4d816..5e4cb0fa 100644 --- a/lib/requestability_resolver.js +++ b/lib/requestability_resolver.js @@ -12,15 +12,14 @@ class RequestabilityResolver { const itemIsInRecap = isInRecap(item) let physRequestableCriteria const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0] - if (itemIsInRecap && !hasRecapCustomerCode) { + if (itemIsInRecap) { // recap items missing codes should default to true for phys and edd // requestable. - physRequestableCriteria = 'Missing customer code' - deliveryInfo = { eddRequestable: true, deliveryLocation: [''] } - } else if (itemIsInRecap && hasRecapCustomerCode) { deliveryInfo = DeliveryLocationsResolver.getRecapDeliveryInfo(item) - physRequestableCriteria = `${deliveryInfo.deliveryLocation && - deliveryInfo.deliveryLocation.length || 0} delivery locations.` + physRequestableCriteria = hasRecapCustomerCode ? + `${deliveryInfo.deliveryLocation && + deliveryInfo.deliveryLocation.length || 0} delivery locations.` + : 'Missing customer code' } else if (!itemIsInRecap) { deliveryInfo = DeliveryLocationsResolver.getOnsiteDeliveryInfo(item) physRequestableCriteria = `${deliveryInfo.deliveryLocation && From 8055d7efa40bae104353b693391c71518f4dbe41 Mon Sep 17 00:00:00 2001 From: danamansana Date: Tue, 14 May 2024 15:12:35 -0400 Subject: [PATCH 10/16] Fix linting --- lib/requestability_resolver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/requestability_resolver.js b/lib/requestability_resolver.js index 5e4cb0fa..02044592 100644 --- a/lib/requestability_resolver.js +++ b/lib/requestability_resolver.js @@ -16,8 +16,8 @@ class RequestabilityResolver { // recap items missing codes should default to true for phys and edd // requestable. deliveryInfo = DeliveryLocationsResolver.getRecapDeliveryInfo(item) - physRequestableCriteria = hasRecapCustomerCode ? - `${deliveryInfo.deliveryLocation && + physRequestableCriteria = hasRecapCustomerCode + ? `${deliveryInfo.deliveryLocation && deliveryInfo.deliveryLocation.length || 0} delivery locations.` : 'Missing customer code' } else if (!itemIsInRecap) { From 958273b695016e4cdd2e0b388837add8c2126770 Mon Sep 17 00:00:00 2001 From: danamansana Date: Mon, 20 May 2024 14:31:07 -0400 Subject: [PATCH 11/16] Add logic and tests for non-requestable items based on customer code and holding location --- lib/delivery-locations-resolver.js | 8 +- lib/requestability_resolver.js | 2 +- test/delivery-locations-resolver.test.js | 22 +- test/fixtures/no_recap_response.js | 808 +++++++++++++++++++++++ test/requestability_resolver.test.js | 19 + 5 files changed, 854 insertions(+), 5 deletions(-) create mode 100644 test/fixtures/no_recap_response.js diff --git a/lib/delivery-locations-resolver.js b/lib/delivery-locations-resolver.js index 864f1939..a4bd279a 100644 --- a/lib/delivery-locations-resolver.js +++ b/lib/delivery-locations-resolver.js @@ -237,10 +237,12 @@ class DeliveryLocationsResolver { let deliveryLocation let eddRequestable const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0] + const nyplItem = isItemNyplOwned(item) if (!hasRecapCustomerCode) { - deliveryLocation = [''] - eddRequestable = this.requestableBasedOnHoldingLocation(item) - } else if (!isItemNyplOwned(item) || this.requestableBasedOnHoldingLocation(item)) { + const requestableBasedOnHoldingLocation = nyplItem ? this.requestableBasedOnHoldingLocation(item) : true + deliveryLocation = requestableBasedOnHoldingLocation ? [''] : [] + eddRequestable = requestableBasedOnHoldingLocation + } else if (!nyplItem || this.requestableBasedOnHoldingLocation(item)) { deliveryLocation = this.deliveryLocationsByRecapCustomerCode(item.recapCustomerCode[0]) eddRequestable = this.__eddRequestableByCustomerCode(item.recapCustomerCode[0]) } else { diff --git a/lib/requestability_resolver.js b/lib/requestability_resolver.js index 02044592..8501036a 100644 --- a/lib/requestability_resolver.js +++ b/lib/requestability_resolver.js @@ -14,7 +14,7 @@ class RequestabilityResolver { const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0] if (itemIsInRecap) { // recap items missing codes should default to true for phys and edd - // requestable. + // requestable, unless it has a non-requestable holding location deliveryInfo = DeliveryLocationsResolver.getRecapDeliveryInfo(item) physRequestableCriteria = hasRecapCustomerCode ? `${deliveryInfo.deliveryLocation && diff --git a/test/delivery-locations-resolver.test.js b/test/delivery-locations-resolver.test.js index e93b312c..e82c434a 100644 --- a/test/delivery-locations-resolver.test.js +++ b/test/delivery-locations-resolver.test.js @@ -9,7 +9,7 @@ var sampleItems = { ], 'holdingLocation': [ { - 'id': 'loc:scff3', + 'id': 'loc:scff2', 'prefLabel': 'Schomburg Center - Research & Reference - Desk' } ], @@ -502,4 +502,24 @@ describe('Delivery-locations-resolver', function () { ).to.equal(true) }) }) + describe('getRecapDeliveryInfo', function () { + it('returns empty deliveryLocation and eddRequestable false based on holding location when missing recapCustomerCode', function () { + const resolved = DeliveryLocationsResolver.getRecapDeliveryInfo({ + holdingLocation: [{ id: 'loc:rccd8' }], + uri: 'i14747243' + }) + expect(resolved.deliveryLocation.length).to.equal(0) + expect(resolved.eddRequestable).to.equal(false) + }) + + it('returns empty deliveryLocation and eddRequestable true based on holding location when missing recapCustomerCode', function () { + const resolved = DeliveryLocationsResolver.getRecapDeliveryInfo({ + holdingLocation: [{ id: 'loc:rcpm2' }], + uri: 'i14747243' + }) + expect(resolved.deliveryLocation.length).to.equal(1) + expect(resolved.deliveryLocation[0]).to.equal('') + expect(resolved.eddRequestable).to.equal(true) + }) + }) }) diff --git a/test/fixtures/no_recap_response.js b/test/fixtures/no_recap_response.js new file mode 100644 index 00000000..37c8dad1 --- /dev/null +++ b/test/fixtures/no_recap_response.js @@ -0,0 +1,808 @@ +exports.fakeElasticSearchResponseNyplItem = () => { + return { + '_shards': { + 'failed': 0, + 'successful': 1, + 'total': 1 + }, + 'took': 1, + 'hits': { + 'total': 1, + 'max_score': 1.3862944, + 'hits': [ + { + '_id': 'b10980129', + '_source': { + 'numItems': [ + 4 + ], + 'createdString': [ + '1989' + ], + 'issuance': [ + { + 'label': 'monograph/item', + 'id': 'urn:biblevel:m' + } + ], + 'creatorLiteral': [ + 'Maḥfūẓ, Najīb, 1911-2006.' + ], + 'creator_sort': [ + 'maḥfūẓ, najīb, 1911-2006.' + ], + 'level': 'debug', + 'items': [ + { + 'uri': 'i22566485', + 'identifier': [ + 'urn:barcode:33433058338470' + ], + 'status': [ + { + 'label': 'Available', + 'id': 'status:a' + } + ] + }, + { + 'uri': 'i22566489' + }, + { + 'holdingLocation_packed': [ + 'loc:scff2||Schomburg Center - Research & Reference' + ], + 'suppressed': [ + false + ], + 'shelfMark': [ + 'Sc D 90-863' + ], + 'accessMessage_packed': [ + 'accessMessage:1||USE IN LIBRARY' + ], + 'uri': 'i10283665', + 'accessMessage': [ + { + 'label': 'USE IN LIBRARY', + 'id': 'accessMessage:1' + } + ], + 'catalogItemType': [ + { + 'id': 'catalogItemType:2', + 'label': 'book non-circ' + } + ], + 'deliveryLocation_packed': [ + 'loc:sc||Schomburg Center' + ], + 'owner': [ + { + 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division', + 'id': 'orgs:1114' + } + ], + 'deliveryLocation': [ + { + 'label': 'Schomburg Center', + 'id': 'loc:sc' + } + ], + 'identifier': [ + 'urn:barcode:32101071572406' + ], + 'requestable': [ + true + ], + 'owner_packed': [ + 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' + ], + 'status': [ + { + 'label': 'Available', + 'id': 'status:a' + } + ], + 'holdingLocation': [ + { + 'label': 'Schomburg Center - Research & Reference', + 'id': 'loc:scff2' + } + ], + 'status_packed': [ + 'status:a||Available' + ] + }, + { + 'holdingLocation_packed': [ + 'loc:scff2||Schomburg Center - Research & Reference' + ], + 'suppressed': [ + false + ], + 'shelfMark': [ + 'Sc D 90-863' + ], + 'accessMessage_packed': [ + 'accessMessage:1||USE IN LIBRARY' + ], + 'uri': 'i10283665777', + 'accessMessage': [ + { + 'label': 'USE IN LIBRARY', + 'id': 'accessMessage:1' + } + ], + 'catalogItemType': [ + { + 'id': 'catalogItemType:2', + 'label': 'book non-circ' + } + ], + 'deliveryLocation_packed': [ + 'loc:sc||Schomburg Center' + ], + 'owner': [ + { + 'label': 'Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division', + 'id': 'orgs:1114' + } + ], + 'deliveryLocation': [ + { + 'label': 'Schomburg Center', + 'id': 'loc:sc' + } + ], + 'identifier': [ + 'urn:barcode:32101071572406777' + ], + 'requestable': [ + true + ], + 'owner_packed': [ + 'orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division' + ], + 'status': [ + { + 'label': 'Not Available', + 'id': 'status:na' + } + ], + 'holdingLocation': [ + { + 'label': 'Schomburg Center - Research & Reference', + 'id': 'loc:scff2' + } + ], + 'status_packed': [ + 'status:na||Not Available' + ] + }, + { + 'holdingLocation': [ + { + 'label': 'OFFSITE - Request in Advance', + 'id': 'loc:rc2ma' + } + ], + 'status_packed': [ + 'status:na||Not Available' + ], + 'owner': [ + { + 'id': 'orgs:1000', + 'label': 'Stephen A. Schwarzman Building' + } + ], + 'deliveryLocation': [ + { + 'id': 'loc:mala', + 'label': 'SASB - Allen Scholar Room' + } + ], + 'deliveryLocation_packed': [ + 'loc:mala||SASB - Allen Scholar Room' + ], + 'uri': 'i10283664', + 'accessMessage_packed': [ + 'accessMessage:2||ADV REQUEST' + ], + 'accessMessage': [ + { + 'id': 'accessMessage:2', + 'label': 'ADV REQUEST' + } + ], + 'status': [ + { + 'id': 'status:na', + 'label': 'Not available' + } + ], + 'owner_packed': [ + 'orgs:1000||Stephen A. Schwarzman Building' + ], + 'requestable': [ + false + ], + 'identifier': [ + 'urn:barcode:1000546836' + ], + 'holdingLocation_packed': [ + 'loc:rc2ma||OFFSITE - Request in Advance' + ], + 'shelfMark': [ + '*OFC 90-2649' + ], + 'suppressed': [ + false + ] + }, + { + 'holdingLocation': [ + { + 'label': 'OFFSITE - Request in Advance', + 'id': 'loc:rc2ma' + } + ], + 'status_packed': [ + 'status:a||Available' + ], + 'owner': [ + { + 'id': 'orgs:1000', + 'label': 'Stephen A. Schwarzman Building' + } + ], + 'deliveryLocation': [ + { + 'id': 'loc:mala', + 'label': 'SASB - Allen Scholar Room' + } + ], + 'deliveryLocation_packed': [ + 'loc:mala||SASB - Allen Scholar Room' + ], + 'uri': 'i102836649', + 'recapCustomerCode': [], + 'accessMessage_packed': [ + 'accessMessage:2||ADV REQUEST' + ], + 'accessMessage': [ + { + 'id': 'accessMessage:2', + 'label': 'ADV REQUEST' + } + ], + 'status': [ + { + 'id': 'status:a', + 'label': 'Available' + } + ], + 'owner_packed': [ + 'orgs:1000||Stephen A. Schwarzman Building' + ], + 'requestable': [ + false + ], + 'identifier': [ + 'urn:barcode:10005468369' + ], + 'holdingLocation_packed': [ + 'loc:rc2ma||OFFSITE - Request in Advance' + ], + 'shelfMark': [ + '*OFC 90-2649 2' + ], + 'suppressed': [ + false + ] + }, + { + 'holdingLocation': [ + { + 'label': 'OFFSITE - Request in Advance', + 'id': 'loc:dya0f' + } + ], + 'status_packed': [ + 'status:a||Available' + ], + 'owner': [ + { + 'id': 'orgs:1000', + 'label': 'Stephen A. Schwarzman Building' + } + ], + 'deliveryLocation': [ + { + 'id': 'loc:mala', + 'label': 'SASB - Allen Scholar Room' + } + ], + 'deliveryLocation_packed': [ + 'loc:mala||SASB - Allen Scholar Room' + ], + 'uri': 'i102836659', + 'recapCustomerCode': [], + 'accessMessage_packed': [ + 'accessMessage:2||ADV REQUEST' + ], + 'accessMessage': [ + { + 'id': 'accessMessage:2', + 'label': 'ADV REQUEST' + } + ], + 'status': [ + { + 'id': 'status:a', + 'label': 'Available' + } + ], + 'owner_packed': [ + 'orgs:1000||Stephen A. Schwarzman Building' + ], + 'requestable': [ + false + ], + 'identifier': [ + 'urn:barcode:10005468369' + ], + 'holdingLocation_packed': [ + 'loc:dya0f||OFFSITE - Request in Advance' + ], + 'shelfMark': [ + '*OFC 90-2649 2' + ], + 'suppressed': [ + false + ] + }, + { + 'holdingLocation': [ + { + 'label': 'OFFSITE - Request in Advance (unrequestable location)', + 'id': 'loc:rcpd8' + } + ], + 'status_packed': [ + 'status:a||Available' + ], + 'owner': [ + { + 'id': 'orgs:1000', + 'label': 'Stephen A. Schwarzman Building' + } + ], + 'uri': 'i102836649-unrequestable', + 'accessMessage_packed': [ + 'accessMessage:2||ADV REQUEST' + ], + 'accessMessage': [ + { + 'id': 'accessMessage:2', + 'label': 'ADV REQUEST' + } + ], + 'status': [ + { + 'id': 'status:a', + 'label': 'Available' + } + ], + 'owner_packed': [ + 'orgs:1000||Stephen A. Schwarzman Building' + ], + 'requestable': [ + false + ], + 'identifier': [ + 'urn:barcode:10005468369' + ], + 'holdingLocation_packed': [ + 'loc:rcpd8||OFFSITE - Request in Advance' + ], + 'shelfMark': [ + '*OFC 90-2649 2' + ], + 'suppressed': [ + false + ] + } + ], + 'message': 'ResourceSerializer#serialize', + 'materialType_packed': [ + 'resourcetypes:txt||Text' + ], + 'suppressed': [ + 'false' + ], + 'placeOfPublication': [ + 'New York :' + ], + 'dateEndString': [ + '1984' + ], + 'title_sort': [ + 'the thief and the dogs' + ], + 'uris': [ + 'b11293188', + 'b11293188-i22566485', + 'b11293188-i22566489', + 'b11293188-i10283665', + 'b11293188-i10283664' + ], + 'language': [ + { + 'id': 'lang:eng', + 'label': 'English' + } + ], + 'dateString': [ + '1989' + ], + 'identifier': [ + 'urn:bnum:11293188', + 'urn:oclc:12248278', + 'urn:lcc:PJ7846.A46', + 'urn:lccCoarse:PJ7695.8-7976' + ], + 'publisher': [ + 'Doubleday,' + ], + 'type': [ + 'nypl:Item' + ], + 'createdYear': [ + 1989 + ], + 'contributor_sort': [ + 'badawī, muḥammad muṣṭafá.' + ], + 'materialType': [ + { + 'id': 'resourcetypes:txt', + 'label': 'Text' + } + ], + 'numAvailable': [ + 2 + ], + 'dimensions': [ + '22 cm.' + ], + 'carrierType_packed': [ + 'carriertypes:nc||volume' + ], + 'note': [ + 'Translation of: al-Liṣṣ wa-al-kilāb.' + ], + 'dateStartYear': [ + 1989 + ], + 'shelfMark': [ + '*OFC 90-2649' + ], + 'idOwi': [ + 'urn:owi:58201773' + ], + 'mediaType': [ + { + 'label': 'unmediated', + 'id': 'mediatypes:n' + } + ], + 'title': [ + 'The thief and the dogs', + 'The thief and the dogs /' + ], + 'titleAlt': [ + 'Liṣṣ wa-al-kilāb.' + ], + 'language_packed': [ + 'lang:eng||English' + ], + 'mediaType_packed': [ + 'mediatypes:n||unmediated' + ], + 'titleDisplay': [ + 'The thief and the dogs / Naguib Mahfouz ; translated by Trevor Le Gassick, M.M. Badawi ; revised by John Rodenbeck.' + ], + 'uri': 'b11293188', + 'extent': [ + '158 p. ;' + ], + 'carrierType': [ + { + 'id': 'carriertypes:nc', + 'label': 'volume' + } + ], + 'issuance_packed': [ + 'urn:biblevel:m||monograph/item' + ], + 'contributorLiteral': [ + 'Badawī, Muḥammad Muṣṭafá.', + 'Le Gassick, Trevor.', + 'Rodenbeck, John.' + ], + 'dateEndYear': [ + 1984 + ] + }, + '_type': 'resource', + '_index': 'resources-2017-06-13', + '_score': 154.93451 + } + ] + }, + 'timed_out': false + } +} + +exports.fakeElasticSearchResponseCulItem = () => { + return { + '_shards': { + 'failed': 0, + 'successful': 1, + 'total': 1 + }, + 'took': 1, + 'hits': { + 'total': 1, + 'max_score': 1.3862944, + 'hits': [ + { + '_type': 'resource', + '_id': 'cb1000077', + '_source': { + 'extent': [ + 'iii, 332 leaves, bound.' + ], + 'note': [ + { + 'noteType': 'Thesis', + 'label': 'Thesis (Ph. D.)--Columbia University, 1989.', + 'type': 'bf:Note' + }, + { + 'noteType': 'Bibliography', + 'label': 'Includes bibliographical references (leaves 314-332).', + 'type': 'bf:Note' + } + ], + 'language': [ + { + 'label': 'English', + 'id': 'lang:eng' + } + ], + 'createdYear': [ + 1989 + ], + 'title': [ + 'Urbanism as a way of writing : Chicago urban sociology and Chicago urban literature, 1915-1945 / Carla Sofia Cappetti.' + ], + 'type': [ + 'nypl:Item' + ], + 'createdString': [ + '1989' + ], + 'creatorLiteral': [ + 'Cappetti, Carla Sofia.' + ], + 'materialType_packed': [ + 'resourcetypes:txt||Text' + ], + 'language_packed': [ + 'lang:eng||English' + ], + 'dateStartYear': [ + 1989 + ], + 'identifierV2': [ + { + 'type': 'nypl:Bnumber', + 'value': '1000077' + } + ], + 'carrierType_packed': [ + 'carriertypes:nc||volume' + ], + 'creator_sort': [ + 'cappetti, carla sofia.' + ], + 'issuance_packed': [ + 'urn:biblevel:m||monograph/item' + ], + 'updatedAt': 1523471203726, + 'publicationStatement': [ + '1989.' + ], + 'mediaType_packed': [ + 'mediatypes:n||unmediated' + ], + 'identifier': [ + 'urn:bnum:1000077' + ], + 'materialType': [ + { + 'label': 'Text', + 'id': 'resourcetypes:txt' + } + ], + 'carrierType': [ + { + 'label': 'volume', + 'id': 'carriertypes:nc' + } + ], + 'dateString': [ + '1989' + ], + 'title_sort': [ + 'urbanism as a way of writing : chicago urban sociology and chicago urban literat' + ], + 'mediaType': [ + { + 'label': 'unmediated', + 'id': 'mediatypes:n' + } + ], + 'titleDisplay': [ + 'Urbanism as a way of writing : Chicago urban sociology and Chicago urban literature, 1915-1945 / Carla Sofia Cappetti.' + ], + 'uri': 'cb1000077', + 'numItems': [ + 1 + ], + 'numAvailable': [ + 1 + ], + 'uris': [ + 'cb1000077', + 'cb1000077-ci1455504' + ], + 'issuance': [ + { + 'label': 'monograph/item', + 'id': 'urn:biblevel:m' + } + ], + 'items': [ + { + 'owner': [ + { + 'label': 'Columbia University Libraries', + 'id': 'orgs:0002' + } + ], + 'accessMessage_packed': [ + 'accessMessage:1||Use in library' + ], + 'identifier': [ + 'urn:barcode:1000020117' + ], + 'catalogItemType_packed': [ + 'catalogItemType:1||non-circ' + ], + 'accessMessage': [ + { + 'label': 'Use in library', + 'id': 'accessMessage:1' + } + ], + 'status_packed': [ + 'status:a||Available ' + ], + 'shelfMark': [ + 'LD1237.5D 1989 .C166' + ], + 'uri': 'ci1455504', + 'recapCustomerCode': [], + 'identifierV2': [ + { + 'type': 'bf:ShelfMark', + 'value': 'LD1237.5D 1989 .C166' + }, + { + 'type': 'bf:Barcode', + 'value': '1000020117' + } + ], + 'idBarcode': [ + '1000020117' + ], + 'owner_packed': [ + 'orgs:0002||Columbia University Libraries' + ], + 'requestable': [ + true + ], + 'catalogItemType': [ + { + 'label': 'non-circ', + 'id': 'catalogItemType:1' + } + ], + 'status': [ + { + 'label': 'Available ', + 'id': 'status:a' + } + ] + }, + { + 'owner': [ + { + 'label': 'Columbia University Libraries', + 'id': 'orgs:0002' + } + ], + 'accessMessage_packed': [ + 'accessMessage:1||Use in library' + ], + 'identifier': [ + 'urn:barcode:10000201179999' + ], + 'catalogItemType_packed': [ + 'catalogItemType:1||non-circ' + ], + 'accessMessage': [ + { + 'label': 'Use in library', + 'id': 'accessMessage:1' + } + ], + 'status_packed': [ + 'status:a||Available ' + ], + 'shelfMark': [ + 'LD1237.5D 1989 .C166 9999' + ], + 'uri': 'ci14555049999', + 'identifierV2': [ + { + 'type': 'bf:ShelfMark', + 'value': 'LD1237.5D 1989 .C166 9999' + }, + { + 'type': 'bf:Barcode', + 'value': '10000201179999' + } + ], + 'idBarcode': [ + '10000201179999' + ], + 'owner_packed': [ + 'orgs:0002||Columbia University Libraries' + ], + 'requestable': [ + true + ], + 'catalogItemType': [ + { + 'label': 'non-circ', + 'id': 'catalogItemType:1' + } + ], + 'status': [ + { + 'label': 'Available ', + 'id': 'status:a' + } + ] + } + ] + } + } + ] + } + } +} diff --git a/test/requestability_resolver.test.js b/test/requestability_resolver.test.js index 164a2a45..47e40f6b 100644 --- a/test/requestability_resolver.test.js +++ b/test/requestability_resolver.test.js @@ -3,6 +3,7 @@ const elasticSearchResponse = require('./fixtures/elastic_search_response.js') const specRequestableElasticSearchResponse = require('./fixtures/specRequestable-es-response') const eddElasticSearchResponse = require('./fixtures/edd_elastic_search_response') const noBarcodeResponse = require('./fixtures/no_barcode_es_response') +const noRecapResponse = require('./fixtures/no_recap_response') describe('RequestabilityResolver', () => { describe('fixItemRequestability', function () { @@ -203,4 +204,22 @@ describe('RequestabilityResolver', () => { expect(nonEddItem.eddRequestable).to.equal(false) }) }) + + describe('Missing recapCustomerCode', function () { + const response = noRecapResponse.fakeElasticSearchResponseNyplItem() + const resolved = RequestabilityResolver.fixItemRequestability(response) + it('marks edd and physical requestability correctly', function () { + const items = resolved.hits.hits[0]._source.items + const firstItem = items.find((item) => { + return item.uri === 'i102836649' + }) + const secondItem = items.find((item) => { + return item.uri === 'i102836659' + }) + expect(firstItem.physRequestable).to.equal(true) + expect(firstItem.eddRequestable).to.equal(true) + expect(secondItem.physRequestable).to.equal(false) + expect(secondItem.eddRequestable).to.equal(false) + }) + }) }) From 985f5930fa890f5f9ff856ed99c7f8f74cc5238f Mon Sep 17 00:00:00 2001 From: danamansana Date: Tue, 28 May 2024 13:26:18 -0400 Subject: [PATCH 12/16] Add explanatory comments --- lib/delivery-locations-resolver.js | 3 +++ test/delivery-locations-resolver.test.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/delivery-locations-resolver.js b/lib/delivery-locations-resolver.js index a4bd279a..60539bbb 100644 --- a/lib/delivery-locations-resolver.js +++ b/lib/delivery-locations-resolver.js @@ -240,6 +240,9 @@ class DeliveryLocationsResolver { const nyplItem = isItemNyplOwned(item) if (!hasRecapCustomerCode) { const requestableBasedOnHoldingLocation = nyplItem ? this.requestableBasedOnHoldingLocation(item) : true + // the length of the list of delivery locations is checked later to determine physical requestability + // In case of an offsite item with no recap customer code, we want this to be based on holding location + // so we put a placeholder '' in case it is requestable based on holding location deliveryLocation = requestableBasedOnHoldingLocation ? [''] : [] eddRequestable = requestableBasedOnHoldingLocation } else if (!nyplItem || this.requestableBasedOnHoldingLocation(item)) { diff --git a/test/delivery-locations-resolver.test.js b/test/delivery-locations-resolver.test.js index e82c434a..dca24d2c 100644 --- a/test/delivery-locations-resolver.test.js +++ b/test/delivery-locations-resolver.test.js @@ -512,7 +512,7 @@ describe('Delivery-locations-resolver', function () { expect(resolved.eddRequestable).to.equal(false) }) - it('returns empty deliveryLocation and eddRequestable true based on holding location when missing recapCustomerCode', function () { + it('returns empty string delivery location and eddRequestable true based on holding location when missing recapCustomerCode', function () { const resolved = DeliveryLocationsResolver.getRecapDeliveryInfo({ holdingLocation: [{ id: 'loc:rcpm2' }], uri: 'i14747243' From dc7baa1e64f7fef288eaad06ad8489e3744c5f9d Mon Sep 17 00:00:00 2001 From: danamansana Date: Tue, 11 Jun 2024 15:15:37 -0400 Subject: [PATCH 13/16] Change test for overwriting location label to use non-obsolete location --- test/location_label_updater.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/location_label_updater.test.js b/test/location_label_updater.test.js index 98224a8e..c6371141 100644 --- a/test/location_label_updater.test.js +++ b/test/location_label_updater.test.js @@ -8,14 +8,14 @@ describe('Location LabelUpdater', function () { '_id': 'b10980129', '_source': { 'items': [{ - 'holdingLocation': [{'id': 'mai87', 'label': 'Some disgusting room'}] + 'holdingLocation': [{'id': 'mai82', 'label': 'Some disgusting room'}] }] } }]} } let updatedResponse = new LocationLabelUpdater(fakeESResponse).responseWithUpdatedLabels() - expect(updatedResponse.hits.hits[0]._source.items[0].holdingLocation[0].label).to.equal('Schwarzman Building - Periodicals and Microforms Room 119') + expect(updatedResponse.hits.hits[0]._source.items[0].holdingLocation[0].label).to.equal('Schwarzman Building M1 - Microforms Room 315') }) it('will overwrite an ElasticSearch Response\'s holdings record location label', function () { From 149c8b690e7b2472a1ff8722386286896de965dc Mon Sep 17 00:00:00 2001 From: danamansana Date: Wed, 12 Jun 2024 14:32:44 -0400 Subject: [PATCH 14/16] Add addedAuthorTitle in search scopes for all and title --- lib/resources.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/resources.js b/lib/resources.js index d7fb3cbf..c774452a 100644 --- a/lib/resources.js +++ b/lib/resources.js @@ -83,7 +83,8 @@ const SEARCH_SCOPES = { 'parallelPublisher', 'uniformTitle.folded', 'parallelUniformTitle', - 'formerTitle' + 'formerTitle', + 'addedAuthorTitle' ] }, title: { @@ -102,7 +103,8 @@ const SEARCH_SCOPES = { 'parallelTitleAlt.folded', 'parallelCreatorLiteral.folded', 'parallelUniformTitle', - 'formerTitle' + 'formerTitle', + 'addedAuthorTitle' ] }, contributor: { From e7122f54101c5c2172d428a8bf96ee73f76e1f0f Mon Sep 17 00:00:00 2001 From: danamansana Date: Wed, 12 Jun 2024 15:24:05 -0400 Subject: [PATCH 15/16] Update fixtures --- ...uery-9dd696a2d60a9578983c4ffe6e904442.json | 1233 +++++++++++++++++ ...uery-edee3d790e0cdd4de27a4e9090f329f2.json | 14 + 2 files changed, 1247 insertions(+) create mode 100644 test/fixtures/query-9dd696a2d60a9578983c4ffe6e904442.json create mode 100644 test/fixtures/query-edee3d790e0cdd4de27a4e9090f329f2.json diff --git a/test/fixtures/query-9dd696a2d60a9578983c4ffe6e904442.json b/test/fixtures/query-9dd696a2d60a9578983c4ffe6e904442.json new file mode 100644 index 00000000..a4ebe59b --- /dev/null +++ b/test/fixtures/query-9dd696a2d60a9578983c4ffe6e904442.json @@ -0,0 +1,1233 @@ +{ + "took": 560, + "timed_out": false, + "_shards": { + "total": 3, + "successful": 3, + "failed": 0 + }, + "hits": { + "total": 34342, + "max_score": 0, + "hits": [] + }, + "aggregations": { + "owner": { + "doc_count": 44396, + "_nested": { + "doc_count_error_upper_bound": 0, + "sum_other_doc_count": 984, + "buckets": [ + { + "key": "orgs:1000||Stephen A. Schwarzman Building", + "doc_count": 10172 + }, + { + "key": "orgs:0003||Princeton University Library", + "doc_count": 7320 + }, + { + "key": "orgs:0002||Columbia University Libraries", + "doc_count": 5941 + }, + { + "key": "orgs:0004||Harvard Library", + "doc_count": 4639 + }, + { + "key": "orgs:1101||General Research Division", + "doc_count": 3537 + }, + { + "key": "orgs:1105||Irma and Paul Milstein Division of United States History, Local History and Genealogy", + "doc_count": 1027 + }, + { + "key": "orgs:1114||Schomburg Center for Research in Black Culture, Jean Blackwell Hutson Research and Reference Division", + "doc_count": 796 + }, + { + "key": "orgs:1002||New York Public Library for the Performing Arts, Dorothy and Lewis B. Cullman Center", + "doc_count": 617 + }, + { + "key": "orgs:1108||Rare Book Division", + "doc_count": 383 + }, + { + "key": "orgs:1110||The Miriam and Ira D. Wallach Division of Art, Prints and Photographs: Art & Architecture Collection", + "doc_count": 324 + } + ] + } + }, + "contributorLiteral": { + "doc_count_error_upper_bound": 19, + "sum_other_doc_count": 40879, + "buckets": [ + { + "key": "Gale (Firm)", + "doc_count": 439 + }, + { + "key": "New York Genealogical and Biographical Society Collection.", + "doc_count": 247 + }, + { + "key": "Sinclair Hamilton Collection of American Illustrated Books. NjP http://id.loc.gov/authorities/names/no2003086490", + "doc_count": 225 + }, + { + "key": "Sinclair Hamilton Collection of American Illustrated Books NjP", + "doc_count": 220 + }, + { + "key": "Hamilton, Alexander, 1757-1804.", + "doc_count": 172 + }, + { + "key": "Alexander Hamilton Institute (U.S.)", + "doc_count": 135 + }, + { + "key": "Ford Collection.", + "doc_count": 129 + }, + { + "key": "Jay, John, 1745-1829.", + "doc_count": 118 + }, + { + "key": "HistoryMakers (Video oral history collection), production company.", + "doc_count": 116 + }, + { + "key": "Madison, James, 1751-1836.", + "doc_count": 105 + }, + { + "key": "Hamilton, Racine Tucker", + "doc_count": 101 + }, + { + "key": "Harty, Hamilton, 1879-1941.", + "doc_count": 90 + }, + { + "key": "Metropolitan Opera (New York, N.Y.)", + "doc_count": 73 + }, + { + "key": "Booz, Allen & Hamilton.", + "doc_count": 62 + }, + { + "key": "Art Gallery of Hamilton (Ont.)", + "doc_count": 55 + }, + { + "key": "Hamilton, Chico, 1921-2013", + "doc_count": 53 + }, + { + "key": "Philip Hamilton McMillan Memorial Publication Fund.", + "doc_count": 53 + }, + { + "key": "Handel, George Frideric, 1685-1759.", + "doc_count": 52 + }, + { + "key": "Metropolitan Opera Radio Broadcast collection.", + "doc_count": 51 + }, + { + "key": "Milton, John, 1608-1674.", + "doc_count": 50 + }, + { + "key": "Hamilton, Newburgh, 1691-1761.", + "doc_count": 49 + }, + { + "key": "Hickey, Matthew", + "doc_count": 49 + }, + { + "key": "Lane, Edgar Carey", + "doc_count": 49 + }, + { + "key": "New York Public Library for the Performing Arts. Billy Rose Theatre Division. Theatre on Film and Tape Archive.", + "doc_count": 46 + }, + { + "key": "Hamilton, Ian, 1938-2001.", + "doc_count": 44 + }, + { + "key": "American Antiquarian Society.", + "doc_count": 43 + }, + { + "key": "Baker, John H. (John Hamilton)", + "doc_count": 43 + }, + { + "key": "Madison, James, 1751-1836", + "doc_count": 40 + }, + { + "key": "Wild Hawthorn Press. pbl", + "doc_count": 40 + }, + { + "key": "Kirk-Greene, A. H. M. (Anthony Hamilton Millard)", + "doc_count": 39 + }, + { + "key": "Geological Survey (U.S.)", + "doc_count": 38 + }, + { + "key": "Hamilton, Iain, 1922-2000.", + "doc_count": 37 + }, + { + "key": "Mabie, Hamilton Wright, 1846-1916.", + "doc_count": 37 + }, + { + "key": "Schomburg Children's Collection.", + "doc_count": 36 + }, + { + "key": "Barr, Alfred Hamilton, 1902-", + "doc_count": 35 + }, + { + "key": "Drexel Collection.", + "doc_count": 35 + }, + { + "key": "Hamilton, Alexander, 1757-1804", + "doc_count": 35 + }, + { + "key": "Long, John Hamilton.", + "doc_count": 35 + }, + { + "key": "Allen, Peter, 1920-2016.", + "doc_count": 34 + }, + { + "key": "Mozart, Wolfgang Amadeus, 1756-1791.", + "doc_count": 34 + }, + { + "key": "Sinclair Hamilton Collection of American Illustrated Books. NjP", + "doc_count": 33 + }, + { + "key": "Children's Room Collection.", + "doc_count": 31 + }, + { + "key": "DHCA.", + "doc_count": 30 + }, + { + "key": "Darley, Felix Octavius Carr, 1822-1888,", + "doc_count": 30 + }, + { + "key": "Bryson, William Hamilton, 1941-", + "doc_count": 27 + }, + { + "key": "Hamilton College (Clinton, N.Y.)", + "doc_count": 27 + }, + { + "key": "Hamilton, Susan (Soprano)", + "doc_count": 27 + }, + { + "key": "Smith, A. H. (Arthur Hamilton), 1860-1941.", + "doc_count": 27 + }, + { + "key": "Hamilton, Charles V.", + "doc_count": 25 + }, + { + "key": "Hamilton, F. E. Ian.", + "doc_count": 25 + } + ] + }, + "materialType": { + "doc_count_error_upper_bound": 0, + "sum_other_doc_count": 0, + "buckets": [ + { + "key": "resourcetypes:txt||Text", + "doc_count": 31925 + }, + { + "key": "resourcetypes:aud||Audio", + "doc_count": 1038 + }, + { + "key": "resourcetypes:mov||Moving image", + "doc_count": 509 + }, + { + "key": "resourcetypes:car||Cartographic", + "doc_count": 256 + }, + { + "key": "resourcetypes:not||Notated music", + "doc_count": 219 + }, + { + "key": "resourcetypes:img||Still image", + "doc_count": 218 + }, + { + "key": "resourcetypes:mix||Mixed material", + "doc_count": 134 + }, + { + "key": "resourcetypes:mul||Multimedia", + "doc_count": 4 + }, + { + "key": "resourcetypes:art||Artifact", + "doc_count": 1 + } + ] + }, + "issuance": { + "doc_count_error_upper_bound": 0, + "sum_other_doc_count": 0, + "buckets": [ + { + "key": "urn:biblevel:m||monograph/item", + "doc_count": 33267 + }, + { + "key": "urn:biblevel:s||serial", + "doc_count": 491 + }, + { + "key": "urn:biblevel:c||collection", + "doc_count": 297 + }, + { + "key": "urn:biblevel:a||monograph component part", + "doc_count": 116 + }, + { + "key": "urn:biblevel:b||serial component part", + "doc_count": 73 + }, + { + "key": "urn:biblevel:d||subunit", + "doc_count": 58 + }, + { + "key": "urn:biblevel:2||", + "doc_count": 12 + }, + { + "key": "urn:biblevel:p||", + "doc_count": 2 + }, + { + "key": "urn:biblevel:i||integrating resource", + "doc_count": 1 + } + ] + }, + "publisher": { + "doc_count_error_upper_bound": 27, + "sum_other_doc_count": 24448, + "buckets": [ + { + "key": "H. Hamilton", + "doc_count": 1286 + }, + { + "key": "Hamish Hamilton", + "doc_count": 815 + }, + { + "key": "Hamilton", + "doc_count": 783 + }, + { + "key": "H. Hamilton,", + "doc_count": 338 + }, + { + "key": "Hamilton Books", + "doc_count": 319 + }, + { + "key": "Hamilton,", + "doc_count": 260 + }, + { + "key": "Hamish Hamilton,", + "doc_count": 255 + }, + { + "key": "s.n.", + "doc_count": 221 + }, + { + "key": "Simpkin, Marshall, Hamilton, Kent", + "doc_count": 190 + }, + { + "key": "Alexander Hamilton Institute", + "doc_count": 172 + }, + { + "key": "Oxford University Press", + "doc_count": 160 + }, + { + "key": "Simpkin, Marshall, Hamilton, Kent & Co., Ltd.", + "doc_count": 125 + }, + { + "key": "Simpkin, Marshall, Hamilton, Kent & Co.", + "doc_count": 121 + }, + { + "key": "Hamilton Books,", + "doc_count": 119 + }, + { + "key": "Macmillan", + "doc_count": 116 + }, + { + "key": "The HistoryMakers", + "doc_count": 116 + }, + { + "key": "Hamilton, Adams", + "doc_count": 111 + }, + { + "key": "[publisher not identified]", + "doc_count": 111 + }, + { + "key": "Press of C. Hamilton", + "doc_count": 102 + }, + { + "key": "[s.n.]", + "doc_count": 79 + }, + { + "key": "Wiley", + "doc_count": 77 + }, + { + "key": "Doubleday", + "doc_count": 76 + }, + { + "key": "Cambridge University Press", + "doc_count": 63 + }, + { + "key": "Wild Hawthorn Press", + "doc_count": 60 + }, + { + "key": "McGraw-Hill", + "doc_count": 58 + }, + { + "key": "J. Hamilton", + "doc_count": 56 + }, + { + "key": "Ticknor and Fields", + "doc_count": 56 + }, + { + "key": "C. Hamilton", + "doc_count": 55 + }, + { + "key": "Harper & Brothers", + "doc_count": 55 + }, + { + "key": "Simpkin, Marshall, Hamilton, Kent & co., ltd.", + "doc_count": 54 + }, + { + "key": "J. Murray", + "doc_count": 52 + }, + { + "key": "Random House", + "doc_count": 51 + }, + { + "key": "Dodd, Mead", + "doc_count": 49 + }, + { + "key": "Putnam", + "doc_count": 49 + }, + { + "key": "s.n.]", + "doc_count": 49 + }, + { + "key": "Harvard University Press", + "doc_count": 48 + }, + { + "key": "Princeton University Press", + "doc_count": 48 + }, + { + "key": "Yale University Press", + "doc_count": 48 + }, + { + "key": "Hamilton, Adams & Co.", + "doc_count": 46 + }, + { + "key": "Routledge", + "doc_count": 46 + }, + { + "key": "Alexander Hamilton institute", + "doc_count": 45 + }, + { + "key": "Charles Hamilton", + "doc_count": 45 + }, + { + "key": "Simpkin, Marshall, Hamilton, Kent,", + "doc_count": 45 + }, + { + "key": "University of Toronto Press", + "doc_count": 42 + }, + { + "key": "G.P. Putnam's Sons", + "doc_count": 39 + }, + { + "key": "Concord Jazz", + "doc_count": 36 + }, + { + "key": "Printed at the Journal office", + "doc_count": 35 + }, + { + "key": "Hamilton & Co.", + "doc_count": 34 + }, + { + "key": "University of Chicago Press", + "doc_count": 34 + }, + { + "key": "Art Gallery of Hamilton", + "doc_count": 33 + } + ] + }, + "language": { + "doc_count_error_upper_bound": 0, + "sum_other_doc_count": 12, + "buckets": [ + { + "key": "lang:eng||English", + "doc_count": 31859 + }, + { + "key": "lang:zxx||No linguistic content", + "doc_count": 326 + }, + { + "key": "lang:fre||French", + "doc_count": 321 + }, + { + "key": "lang:ger||German", + "doc_count": 280 + }, + { + "key": "lang:por||Portuguese", + "doc_count": 177 + }, + { + "key": "lang:ita||Italian", + "doc_count": 162 + }, + { + "key": "lang:spa||Spanish", + "doc_count": 158 + }, + { + "key": "lang:lat||Latin", + "doc_count": 128 + }, + { + "key": "lang:swe||Swedish", + "doc_count": 71 + }, + { + "key": "lang:|||||", + "doc_count": 62 + }, + { + "key": "lang:heb||Hebrew", + "doc_count": 35 + }, + { + "key": "lang:rus||Russian", + "doc_count": 28 + }, + { + "key": "lang:und||Undetermined", + "doc_count": 22 + }, + { + "key": "lang:mul||Multiple languages", + "doc_count": 20 + }, + { + "key": "lang:dut||Dutch", + "doc_count": 16 + }, + { + "key": "lang:ara||Arabic", + "doc_count": 14 + }, + { + "key": "lang:dan||Danish", + "doc_count": 13 + }, + { + "key": "lang:chi||Chinese", + "doc_count": 12 + }, + { + "key": "lang:grc||Greek, Ancient (to 1453)", + "doc_count": 11 + }, + { + "key": "lang:jpn||Japanese", + "doc_count": 9 + }, + { + "key": "lang:nor||Norwegian", + "doc_count": 9 + }, + { + "key": "lang:pol||Polish", + "doc_count": 8 + }, + { + "key": "lang:cze||Czech", + "doc_count": 7 + }, + { + "key": "lang:gre||Greek, Modern (1453- )", + "doc_count": 7 + }, + { + "key": "lang:gle||Irish", + "doc_count": 6 + }, + { + "key": "lang:kor||Korean", + "doc_count": 6 + }, + { + "key": "lang:per||Persian", + "doc_count": 6 + }, + { + "key": "lang:tur||Turkish", + "doc_count": 5 + }, + { + "key": "lang:cat||Catalan", + "doc_count": 4 + }, + { + "key": "lang:lav||Latvian", + "doc_count": 4 + }, + { + "key": "lang:fro||French, Old (ca. 842-1300)", + "doc_count": 3 + }, + { + "key": "lang:nai||North American Indian (Other)", + "doc_count": 3 + }, + { + "key": "lang:ukr||Ukrainian", + "doc_count": 3 + }, + { + "key": "lang:afr||Afrikaans", + "doc_count": 2 + }, + { + "key": "lang:asm||Assamese", + "doc_count": 2 + }, + { + "key": "lang:bnt||Bantu (Other)", + "doc_count": 2 + }, + { + "key": "lang:bul||Bulgarian", + "doc_count": 2 + }, + { + "key": "lang:frm||French, Middle (ca. 1300-1600)", + "doc_count": 2 + }, + { + "key": "lang:gla||Scottish Gaelic", + "doc_count": 2 + }, + { + "key": "lang:hau||Hausa", + "doc_count": 2 + }, + { + "key": "lang:wel||Welsh", + "doc_count": 2 + }, + { + "key": "lang:N/A||", + "doc_count": 1 + }, + { + "key": "lang:afa||Afroasiatic (Other)", + "doc_count": 1 + }, + { + "key": "lang:ang||English, Old (ca. 450-1100)", + "doc_count": 1 + }, + { + "key": "lang:arm||Armenian", + "doc_count": 1 + }, + { + "key": "lang:ben||Bengali", + "doc_count": 1 + }, + { + "key": "lang:enm||English, Middle (1100-1500)", + "doc_count": 1 + }, + { + "key": "lang:epo||Esperanto", + "doc_count": 1 + }, + { + "key": "lang:gem||Germanic (Other)", + "doc_count": 1 + }, + { + "key": "lang:hin||Hindi", + "doc_count": 1 + } + ] + }, + "mediaType": { + "doc_count_error_upper_bound": 0, + "sum_other_doc_count": 0, + "buckets": [ + { + "key": "mediatypes:n||unmediated", + "doc_count": 32700 + }, + { + "key": "mediatypes:undefined||unmediated", + "doc_count": 1318 + }, + { + "key": "mediatypes:s||audio", + "doc_count": 224 + }, + { + "key": "mediatypes:v||video", + "doc_count": 32 + }, + { + "key": "mediatypes:h||microform", + "doc_count": 29 + }, + { + "key": "mediatypes:undefined||microform", + "doc_count": 16 + }, + { + "key": "mediatypes:c||computer", + "doc_count": 13 + }, + { + "key": "mediatypes:undefined||audio", + "doc_count": 10 + }, + { + "key": "mediatypes:g||projected", + "doc_count": 1 + }, + { + "key": "mediatypes:n||computer", + "doc_count": 1 + }, + { + "key": "mediatypes:undefined||text", + "doc_count": 1 + }, + { + "key": "mediatypes:z||unspecified", + "doc_count": 1 + } + ] + }, + "subjectLiteral": { + "doc_count_error_upper_bound": 35, + "sum_other_doc_count": 86020, + "buckets": [ + { + "key": "Hamilton, Alexander, 1757-1804.", + "doc_count": 480 + }, + { + "key": "United States.", + "doc_count": 380 + }, + { + "key": "1900-1999", + "doc_count": 214 + }, + { + "key": "United States", + "doc_count": 180 + }, + { + "key": "African Americans.", + "doc_count": 156 + }, + { + "key": "Hamilton, Emma, Lady, 1765-1815.", + "doc_count": 119 + }, + { + "key": "African Americans -- Interviews.", + "doc_count": 117 + }, + { + "key": "Great Britain.", + "doc_count": 113 + }, + { + "key": "Operas.", + "doc_count": 99 + }, + { + "key": "Artists' books.", + "doc_count": 98 + }, + { + "key": "Hamilton family.", + "doc_count": 94 + }, + { + "key": "English fiction.", + "doc_count": 90 + }, + { + "key": "Great Britain", + "doc_count": 89 + }, + { + "key": "1800-1899", + "doc_count": 88 + }, + { + "key": "Jefferson, Thomas, 1743-1826.", + "doc_count": 82 + }, + { + "key": "Great Britain -- Court and courtiers.", + "doc_count": 77 + }, + { + "key": "Jazz.", + "doc_count": 77 + }, + { + "key": "Tariff -- United States.", + "doc_count": 75 + }, + { + "key": "United States -- Politics and government -- 1783-1809.", + "doc_count": 72 + }, + { + "key": "English poetry.", + "doc_count": 71 + }, + { + "key": "Hamilton, Alexander, 1757-1804", + "doc_count": 71 + }, + { + "key": "Authors, English -- 20th century -- Biography.", + "doc_count": 68 + }, + { + "key": "Constitutional law -- United States.", + "doc_count": 67 + }, + { + "key": "Politics and government.", + "doc_count": 66 + }, + { + "key": "Travel.", + "doc_count": 65 + }, + { + "key": "Manners and customs.", + "doc_count": 63 + }, + { + "key": "Piano music.", + "doc_count": 63 + }, + { + "key": "Statesmen -- United States -- Biography.", + "doc_count": 63 + }, + { + "key": "Theater -- New York (State) -- New York.", + "doc_count": 63 + }, + { + "key": "Gramont, Philibert, comte de, 1621-1707.", + "doc_count": 62 + }, + { + "key": "Politics and government", + "doc_count": 61 + }, + { + "key": "United States -- Politics and government -- 1775-1783.", + "doc_count": 61 + }, + { + "key": "Nelson, Horatio Nelson, Viscount, 1758-1805.", + "doc_count": 56 + }, + { + "key": "2000-2099", + "doc_count": 55 + }, + { + "key": "Economics.", + "doc_count": 55 + }, + { + "key": "English drama.", + "doc_count": 55 + }, + { + "key": "United States -- Description and travel.", + "doc_count": 55 + }, + { + "key": "English fiction", + "doc_count": 52 + }, + { + "key": "Concrete poetry.", + "doc_count": 51 + }, + { + "key": "Bible. -- Criticism, interpretation, etc.", + "doc_count": 49 + }, + { + "key": "Fiction in English, 1945- - Texts", + "doc_count": 48 + }, + { + "key": "Adams, John, 1735-1826.", + "doc_count": 47 + }, + { + "key": "Hamilton County (Ohio) -- Genealogy.", + "doc_count": 46 + }, + { + "key": "Hamilton, Emma, Lady, 1765-1815", + "doc_count": 46 + }, + { + "key": "Voyages and travels.", + "doc_count": 45 + }, + { + "key": "Washington, George, 1732-1799.", + "doc_count": 45 + }, + { + "key": "Jazz vocals.", + "doc_count": 44 + }, + { + "key": "Burr, Aaron, 1756-1836.", + "doc_count": 41 + }, + { + "key": "Business.", + "doc_count": 41 + }, + { + "key": "Education.", + "doc_count": 41 + } + ] + }, + "creatorLiteral": { + "doc_count_error_upper_bound": 24, + "sum_other_doc_count": 26786, + "buckets": [ + { + "key": "Finlay, Ian Hamilton.", + "doc_count": 165 + }, + { + "key": "Mabie, Hamilton Wright, 1846-1916.", + "doc_count": 146 + }, + { + "key": "Hamilton, Alexander, 1757-1804.", + "doc_count": 116 + }, + { + "key": "Hamilton, Virginia, 1936-2002.", + "doc_count": 86 + }, + { + "key": "Maxwell, W. H. (William Hamilton), 1792-1850.", + "doc_count": 84 + }, + { + "key": "Carey, Mathew, 1760-1839.", + "doc_count": 80 + }, + { + "key": "Hamilton, Gail, 1833-1896.", + "doc_count": 80 + }, + { + "key": "Child, Hamilton, 1836-", + "doc_count": 76 + }, + { + "key": "Handel, George Frideric, 1685-1759.", + "doc_count": 72 + }, + { + "key": "Hamilton, Iain, 1922-2000.", + "doc_count": 69 + }, + { + "key": "Hamilton, Mary Agnes, 1884-1966.", + "doc_count": 67 + }, + { + "key": "Lockhart, Robert Hamilton Bruce, 1887-1970.", + "doc_count": 62 + }, + { + "key": "Hamilton, James, 1814-1867.", + "doc_count": 57 + }, + { + "key": "Stephens, Alexander H. (Alexander Hamilton), 1812-1883.", + "doc_count": 51 + }, + { + "key": "Eaton, Arthur Wentworth Hamilton, 1849-1937.", + "doc_count": 50 + }, + { + "key": "Hamilton, Anthony, Count, approximately 1646-1720.", + "doc_count": 50 + }, + { + "key": "Fyfe, Hamilton, 1869-1951.", + "doc_count": 49 + }, + { + "key": "Hurd, D. Hamilton (Duane Hamilton)", + "doc_count": 47 + }, + { + "key": "Hamilton, Clayton Meeker, 1881-1946.", + "doc_count": 46 + }, + { + "key": "Basso, Hamilton, 1904-1964.", + "doc_count": 45 + }, + { + "key": "Hamilton, Patrick, 1904 March 17-1962.", + "doc_count": 45 + }, + { + "key": "Hamilton-Paterson, James.", + "doc_count": 45 + }, + { + "key": "Sears, Edmund H. (Edmund Hamilton), 1810-1876.", + "doc_count": 45 + }, + { + "key": "Booz, Allen & Hamilton.", + "doc_count": 44 + }, + { + "key": "Hamilton, Cicely, 1872-1952.", + "doc_count": 43 + }, + { + "key": "Kirk-Greene, A. H. M. (Anthony Hamilton Millard)", + "doc_count": 43 + }, + { + "key": "Moore, John Hamilton, -1807.", + "doc_count": 43 + }, + { + "key": "West, Jerry, 1910-1975.", + "doc_count": 43 + }, + { + "key": "Hamilton, William, Sir, 1788-1856.", + "doc_count": 42 + }, + { + "key": "Cushing, Frank Hamilton, 1857-1900.", + "doc_count": 39 + }, + { + "key": "Hamilton, Ian, 1938-2001.", + "doc_count": 39 + }, + { + "key": "Thompson, A. Hamilton (Alexander Hamilton), 1873-1952.", + "doc_count": 39 + }, + { + "key": "Hamilton, Edith, 1867-1963.", + "doc_count": 38 + }, + { + "key": "Hartley, L. P. (Leslie Poles), 1895-1972.", + "doc_count": 37 + }, + { + "key": "Hamilton College (Clinton, N.Y.)", + "doc_count": 36 + }, + { + "key": "Brogan, D. W. (Denis William), 1900-1974.", + "doc_count": 35 + }, + { + "key": "Gibbs, A. Hamilton (Arthur Hamilton), 1888-1964.", + "doc_count": 34 + }, + { + "key": "Gibson, W. Hamilton (William Hamilton), 1850-1896.", + "doc_count": 34 + }, + { + "key": "Moorehead, Alan, 1910-1983.", + "doc_count": 34 + }, + { + "key": "Gibb, H. A. R. (Hamilton Alexander Rosskeen), 1895-1971.", + "doc_count": 32 + }, + { + "key": "Hamilton, Cosmo, 1872?-1942.", + "doc_count": 32 + }, + { + "key": "Hamilton, Ian, 1853-1947.", + "doc_count": 32 + }, + { + "key": "Baldwin-Lima-Hamilton Corporation.", + "doc_count": 31 + }, + { + "key": "Hill, Hamilton Andrews, 1827-1895.", + "doc_count": 31 + }, + { + "key": "Ellis, Cuthbert Hamilton, 1909-", + "doc_count": 29 + }, + { + "key": "Hamilton, Thomas, 1789-1842.", + "doc_count": 28 + }, + { + "key": "Myers, P. Hamilton (Peter Hamilton), 1812-1878.", + "doc_count": 27 + }, + { + "key": "Simenon, Georges, 1903-1989.", + "doc_count": 26 + }, + { + "key": "Hamilton, Nigel.", + "doc_count": 25 + }, + { + "key": "Baker, John H. (John Hamilton)", + "doc_count": 24 + } + ] + } + } +} \ No newline at end of file diff --git a/test/fixtures/query-edee3d790e0cdd4de27a4e9090f329f2.json b/test/fixtures/query-edee3d790e0cdd4de27a4e9090f329f2.json new file mode 100644 index 00000000..07b99d88 --- /dev/null +++ b/test/fixtures/query-edee3d790e0cdd4de27a4e9090f329f2.json @@ -0,0 +1,14 @@ +{ + "took": 105, + "timed_out": false, + "_shards": { + "total": 3, + "successful": 3, + "failed": 0 + }, + "hits": { + "total": 0, + "max_score": null, + "hits": [] + } +} \ No newline at end of file From e4dbd40b4a9dfe0515af91672dd72df82088f1d8 Mon Sep 17 00:00:00 2001 From: danamansana Date: Tue, 18 Jun 2024 11:41:26 -0400 Subject: [PATCH 16/16] Fix broken test --- test/location_label_updater.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/location_label_updater.test.js b/test/location_label_updater.test.js index c6371141..b54be368 100644 --- a/test/location_label_updater.test.js +++ b/test/location_label_updater.test.js @@ -15,7 +15,7 @@ describe('Location LabelUpdater', function () { } let updatedResponse = new LocationLabelUpdater(fakeESResponse).responseWithUpdatedLabels() - expect(updatedResponse.hits.hits[0]._source.items[0].holdingLocation[0].label).to.equal('Schwarzman Building M1 - Microforms Room 315') + expect(updatedResponse.hits.hits[0]._source.items[0].holdingLocation[0].label).to.equal('Schwarzman Building - Microforms Room 315') }) it('will overwrite an ElasticSearch Response\'s holdings record location label', function () {