Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
579eec5
Fix query structure
danamansana Dec 1, 2025
ae28b72
Add more permissive key structure
danamansana Dec 4, 2025
8b6000f
Remove console logs and commented code
danamansana Dec 4, 2025
e5b61dc
Fix linter errors
danamansana Dec 4, 2025
6ca7e33
Exclude parentheses in query term
danamansana Dec 18, 2025
39c0920
Make keyphrase/non_ws_key lowercase
danamansana Dec 18, 2025
6714e24
Change callNumber to callnumber to enable callnumber searches
danamansana Dec 18, 2025
cd4c24f
Add finding text by key for atomic queries
danamansana Jan 7, 2026
58a0d9f
Merge branch 'main' into scc-5168
danamansana Jan 29, 2026
8b3e4e1
Add initial bnf
danamansana Jan 30, 2026
87c1e32
Update packages
danamansana Jan 30, 2026
a55444d
Add alternate grammars and comment for atomic
danamansana Jan 30, 2026
05dfb3f
Add reverseGrammar and related methods
danamansana Feb 5, 2026
f373383
Apparently working left associating cql
danamansana Feb 5, 2026
951a8e8
Clean up grammar file
danamansana Feb 6, 2026
3a03d81
Use parseWithRightCql in query builder and tests
danamansana Feb 6, 2026
1952828
Remove console log and commented code'
danamansana Feb 6, 2026
3a83857
Fix some param passing and start adding query tests
danamansana Feb 9, 2026
d2109f5
Add tests for atomic queries and some small corrections
danamansana Feb 10, 2026
baf803c
Add initial boolean tests
danamansana Feb 10, 2026
8842a88
Add tests for negation
danamansana Feb 11, 2026
fd8ff37
Fix linting/tests/small errors
danamansana Feb 11, 2026
271c692
Add date queries
danamansana Feb 19, 2026
ffe585f
Add filters to cql query builder
danamansana Feb 19, 2026
1473e3d
Fix some small errors
danamansana Feb 19, 2026
ed4c14a
Add initial filter implementation for cql
danamansana Feb 20, 2026
74f97a4
Fix tests
danamansana Feb 20, 2026
d5cee7f
Add date and filter features to cql
danamansana Feb 20, 2026
e2e43d0
Add some more useful display of parsing and errors
danamansana Feb 20, 2026
93c042e
Fix linting
danamansana Feb 20, 2026
9c98372
Merge pull request #650 from NYPL/scc-5203
danamansana Feb 27, 2026
0ebe3bd
Add new strategy for handling keyword vs text fields
danamansana Mar 2, 2026
b2ebcab
Add exact match query
danamansana Mar 2, 2026
98321ab
Update to latest prod resource index
yossariano Mar 10, 2026
da4d5aa
Merge pull request #663 from NYPL/NOREF-update-prod-resource-index
yossariano Mar 10, 2026
891e41d
Support for _displayPacked fields (contributors and creators)
yossariano Mar 11, 2026
3dcbf33
refactor
charmingduchess Mar 12, 2026
c0c5464
Merge pull request #667 from NYPL/SCC-5277-display-packed
yossariano Mar 12, 2026
643b8df
fix filter
charmingduchess Mar 12, 2026
d4b31bc
Bump core to 2.39
7emansell Mar 12, 2026
220f336
Add collection access type to item holding location, plus test
7emansell Mar 12, 2026
c5d482d
Add shelfmark sorting for callnumber searches
danamansana Mar 13, 2026
36e6302
Fixes in response to PR comments
danamansana Mar 13, 2026
df19f00
Merge pull request #674 from NYPL/scc-4668
danamansana Mar 13, 2026
fa97479
Update collection entities to include locationsPath, bump nypl-core-o…
7emansell Mar 13, 2026
129f9a6
One more test
7emansell Mar 13, 2026
af3fdab
Make getFormattedHoldingLocation more defensive
7emansell Mar 13, 2026
b88014e
Merge pull request #672 from NYPL/SCC-5208/filter-fix
charmingduchess Mar 16, 2026
b6dcd86
the tests
charmingduchess Mar 16, 2026
3aa92cd
add int test file
charmingduchess Mar 16, 2026
57fef73
Merge branch 'production' into SCC-5164/delivery-integration-test
charmingduchess Mar 16, 2026
b62d846
rm commented code
charmingduchess Mar 16, 2026
66b2af2
Merge pull request #668 from NYPL/noref-refactor-deployment
charmingduchess Mar 17, 2026
4c9e284
Merge branch 'main' into SCC-5164/delivery-integration-test
charmingduchess Mar 17, 2026
8f07bfc
test
charmingduchess Mar 18, 2026
bf3c9ff
Merge pull request #683 from NYPL/SCC-5164/delivery-integration-test-…
charmingduchess Mar 18, 2026
3d0a596
Merge branch 'main' into SCC-5090/collection-access-type
7emansell Mar 18, 2026
cec1e53
Merge pull request #673 from NYPL/SCC-5090/collection-access-type
7emansell Mar 18, 2026
d5ec597
Add check for whether query has fields before adding
danamansana Mar 19, 2026
f53c870
expect scholar delivery for m1 item/scholar
charmingduchess Mar 19, 2026
4f26b20
Remove console log
danamansana Mar 19, 2026
94d0d61
Fix tests
danamansana Mar 19, 2026
e0e8f6b
Add reversing strings in nested array
danamansana Mar 19, 2026
48066b4
Merge pull request #685 from NYPL/SCC-5164/delivery-integration-test-…
charmingduchess Mar 19, 2026
d65a3d3
Remove double reversing in display
danamansana Mar 19, 2026
330e170
Fix double nesting of should array for dates
danamansana Mar 20, 2026
b0f7585
Fix date test fixtures
danamansana Mar 20, 2026
e046813
Merge pull request #643 from NYPL/scc-5168
danamansana Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: integration-test

on:
pull_request:
branches:
- production

jobs:
integration-test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- uses: actions/checkout@v3
- name: Set Node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: npm install
run: npm i
- name: Run integration tests
env:
ENV: 'qa'
run: node test/integration/delivery-locations-by-barcode.test.js
133 changes: 20 additions & 113 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Unit Tests

on: [push]

# Global environment variable based on the branch name
env:
ENV_TAG: ${{ github.ref_name }}
ECR_REPOSITORY: discovery-api

jobs:
tests:
runs-on: ubuntu-latest
Expand All @@ -15,114 +20,15 @@ jobs:
run: npm ci
- name: Unit Tests
run: npm test
integration-test-qa:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/qa'
steps:
- uses: actions/checkout@v4
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Start service
run: ENV=qa npm start &
- name: Run tests
run: npm run test-integration
deploy-qa:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs:
- tests
if: github.ref == 'refs/heads/qa'
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- name: Log in to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Back up previous image for rollback
env:
ECR_REPOSITORY: discovery-api
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="qa-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
PREVIOUS_MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="qa-previous" --output json | jq --raw-output --join-output '.images[0].imageManifest')
if [ "$MANIFEST" != "$PREVIOUS_MANIFEST" ]; then aws ecr put-image --repository-name $ECR_REPOSITORY --image-tag "qa-previous" --image-manifest "$MANIFEST"; fi
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-api
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
- name: Force ECS Update
run: |
aws ecs update-service --cluster discovery-api-qa --service discovery-api-qa --force-new-deployment
deploy-qa2:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs:
- tests
if: github.ref == 'refs/heads/qa2'
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1

- name: Log in to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Back up previous image for rollback
env:
ECR_REPOSITORY: discovery-api
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="qa2-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
PREVIOUS_MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="qa2-previous" --output json | jq --raw-output --join-output '.images[0].imageManifest')
if [ "$MANIFEST" != "$PREVIOUS_MANIFEST" ]; then aws ecr put-image --repository-name $ECR_REPOSITORY --image-tag "qa2-previous" --image-manifest "$MANIFEST"; fi
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-api
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:qa2-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:qa2-latest

- name: Force ECS Update
run: |
aws ecs update-service --cluster discovery-api-qa2 --service discovery-api-qa2 --force-new-deployment
deploy-production:
deploy:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/production'
# Only run if it's one of our three deployment branches
if: contains(fromJSON('["qa", "qa2", "production"]'), github.ref_name)
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -138,22 +44,23 @@ jobs:
uses: aws-actions/amazon-ecr-login@v1

- name: Back up previous image for rollback
env:
ECR_REPOSITORY: discovery-api
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="production-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
PREVIOUS_MANIFEST=$(aws ecr batch-get-image --repository-name $ECR_REPOSITORY --image-ids imageTag="production-previous" --output json | jq --raw-output --join-output '.images[0].imageManifest')
if [ "$MANIFEST" != "$PREVIOUS_MANIFEST" ]; then aws ecr put-image --repository-name $ECR_REPOSITORY --image-tag "production-previous" --image-manifest "$MANIFEST"; fi
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.ECR_REPOSITORY }} --image-ids imageTag="${{ env.ENV_TAG }}-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
PREVIOUS_MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.ECR_REPOSITORY }} --image-ids imageTag="${{ env.ENV_TAG }}-previous" --output json | jq --raw-output --join-output '.images[0].imageManifest')
if [ "$MANIFEST" != "$PREVIOUS_MANIFEST" ]; then
aws ecr put-image --repository-name ${{ env.ECR_REPOSITORY }} --image-tag "${{ env.ENV_TAG }}-previous" --image-manifest "$MANIFEST"
fi

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: discovery-api
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:production-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:production-latest
docker build -t $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG .
docker push $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG
docker tag $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.ENV_TAG }}-latest
docker push $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.ENV_TAG }}-latest

- name: Force ECS Update
run: |
aws ecs update-service --cluster discovery-api-production --service discovery-api-production --force-new-deployment
aws ecs update-service --cluster discovery-api-${{ env.ENV_TAG }} --service discovery-api-${{ env.ENV_TAG }} --force-new-deployment
2 changes: 1 addition & 1 deletion config/production.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/
ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g==
ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.37
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=info
FEATURES=on-site-edd
Expand Down
2 changes: 1 addition & 1 deletion config/qa.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/
ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g==
ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.37
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=debug
FEATURES=on-site-edd
Expand Down
2 changes: 1 addition & 1 deletion config/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NYPL_OAUTH_URL=http://oauth.example.com
NYPL_OAUTH_ID=encrypted-nypl-oauth-id
NYPL_OAUTH_SECRET=encrypted-nypl-oauth-id

NYPL_CORE_VERSION=v2.37
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=error
FEATURES=on-site-edd
Expand Down
6 changes: 3 additions & 3 deletions lib/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,21 @@ module.exports = function (app, _private = null) {
}

/**
* Builds an aggregation query that checks the resource index for counts on the contributorRoleLiteral field for a list of contributors.
* Builds an aggregation query that checks the resource index for counts on the browseableContributorRole_packed field for a list of contributors.
*/
const buildElasticRoleCountQuery = function (contributorList) {
return {
size: 0,
query: {
terms: {
contributorRoleLiteral: contributorList
browseableContributorRole_packed: contributorList
}
},
aggs: {
contributor_role: {
terms: {
script: {
source: 'def results = []; for (val in doc["contributorRoleLiteral"]) { int pos = val.indexOf("||"); if (pos != -1) { String name = val.substring(0, pos); if (params.targets.contains(name)) { results.add(val); } } } return results;',
source: 'def results = []; for (val in doc["browseableContributorRole_packed"]) { int pos = val.indexOf("||"); if (pos != -1) { String name = val.substring(0, pos); if (params.targets.contains(name)) { results.add(val); } } } return results;',
params: {
targets: contributorList
}
Expand Down
25 changes: 25 additions & 0 deletions lib/display-field-unpacker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const parseValueAndLabel = (delimitedString) => {
if (!delimitedString.includes('||')) {
return { value: delimitedString, display: null }
}
const [value, display] = delimitedString.split('||')
return { value, display }
}

module.exports = (elasticSearchResponse) => {
elasticSearchResponse.hits.hits.forEach((bib) => {
// Contributors and creators are packed like so <name>||<display label> where <display label>
// can have prefix, title, and roles. We'd like to unpack them in a friendly format for the frontend
// to display the full label and use the isolated name for link-building
Object.entries(bib._source).forEach(([key, value]) => {
if (key.endsWith('_displayPacked')) {
const fieldName = key.replace('_displayPacked', '')
bib._source[fieldName + 'Display'] = value.map((packedValue) => parseValueAndLabel(packedValue))
delete bib._source[key]
}
})

return bib
})
return elasticSearchResponse
}
5 changes: 3 additions & 2 deletions lib/elasticsearch/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const SEARCH_SCOPES = {
},
standard_number: {
// We do custom field matching for this search-scope
}
},
cql: {} // see cql/index_mapping for this search scope
}

const FILTER_CONFIG = {
Expand All @@ -89,7 +90,7 @@ const FILTER_CONFIG = {
mediaType: { operator: 'match', field: ['mediaType.id', 'mediaType.label'], repeatable: true },
carrierType: { operator: 'match', field: ['carrierType.id', 'carrierType.label'], repeatable: true },
publisher: { operator: 'match', field: ['publisherLiteral.raw'], repeatable: true },
contributorLiteral: { operator: 'match', field: ['contributorLiteral.keywordLowercased', 'parallelContributor.raw', 'creatorLiteral.keywordLowercased', 'parallelCreatorLiteral.raw'], repeatable: true },
contributorLiteral: { operator: 'match', field: ['contributorLiteral.keywordLowercased', 'parallelContributorLiteral.raw', 'creatorLiteral.keywordLowercased', 'parallelCreatorLiteral.raw'], repeatable: true },
creatorLiteral: { operator: 'match', field: ['creatorLiteral.raw', 'parallelCreatorLiteral.raw'], repeatable: true },
issuance: { operator: 'match', field: ['issuance.id', 'issuance.label'], repeatable: true },
createdYear: { operator: 'match', field: ['createdYear'], repeatable: true },
Expand Down
Loading
Loading