Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/qa-node20-es-tuning…
Browse files Browse the repository at this point in the history
…' into qa-node20-es-tuning
  • Loading branch information
nonword committed Jun 14, 2024
2 parents ab04699 + cc6dec6 commit e697a51
Show file tree
Hide file tree
Showing 94 changed files with 103,618 additions and 15,206 deletions.
4 changes: 2 additions & 2 deletions config/qa.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Greg built self-hosted production domain:
ENCRYPTED_ELASTICSEARCH_URI=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHgwdgYJKoZIhvcNAQcGoGkwZwIBADBiBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDIYpOz/BbRlJZUul7gIBEIA1idumQ6fdf/j5/pzF4t96MGGH/eV1gD4WCyLUnScgNYqtRNK0ajRO6XVroswsrJtgCwUerDM=
# resources-2024-06-07:
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHIwcAYJKoZIhvcNAQcGoGMwYQIBADBcBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDGCD4H/9mg45Xe52jgIBEIAv+c8zw6vCnaLRRNvM0d9bsh97ZB7pwjn8Zim93cYTc0oKGs9G52G3HsJsGT855N8=
# resources-2024-06-13:
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHIwcAYJKoZIhvcNAQcGoGMwYQIBADBcBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHp+Hkdg9AqFe18QggIBEIAvZqSBQgs8v/wpkOVl5q54mQtuvBZpnXYDGc+zxiUHLZLKsqiCs58dGFnZvekDWXs=

ENCRYPTED_SCSB_URL=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAH8wfQYJKoZIhvcNAQcGoHAwbgIBADBpBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDBKllElmWYLxGOGopQIBEIA8JJyKde/8m8iCJGKR5D8HoTJhXHeyvw9eIDeuUNKiXLfJwoVz+PDAZSxkCQtM9O91zGhXbe3l6Bk1RlYJ
ENCRYPTED_SCSB_API_KEY=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGMwYQYJKoZIhvcNAQcGoFQwUgIBADBNBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDNw8KXkyN8HvtjAX0gIBEIAgX+XG2fxTj6kSchrd/dfHB05KU5pkT0LtPxUTuNCXoLc=
Expand Down
4 changes: 3 additions & 1 deletion lib/availability_resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ class AvailabilityResolver {
logger.debug('_fixItemStatusAggregation: Skipping because no SCSB statuses provided')
return Promise.resolve()
}
const bnum = resp.hits.hits[0]._id
const bnum = resp.hits.hits[0]?._id
if (!bnum) return

const { nyplSource } = NyplSourceMapper.instance().splitIdentifier(bnum)

// Get total number of items:
Expand Down
2 changes: 1 addition & 1 deletion lib/es-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ clientWrapper.esClient = function () {
port,
auth: { username, password }
}
logger.debug(`Connecting to ES at ${host}:${port} ${username && password ? 'with creds' : 'w/out creds'}`)
logger.debug(`Connecting to ES at ${host}:${port}/${process.env.RESOURCES_INDEX} ${username && password ? 'with creds' : 'w/out creds'}`)
this._esClient = new elasticsearch.Client(options)
}
return this._esClient
Expand Down
14 changes: 11 additions & 3 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ module.exports = function (app, _private = null) {
script: {
script: {
inline: 'doc[\'items.idBarcode\'].value == null || ' +
'params.unavailableRecapBarcodes.contains(doc[\'items.idBarcode\'].values[0])',
'params.unavailableRecapBarcodes.contains(doc[\'items.idBarcode\'][0])',
lang: 'painless',
params: { unavailableRecapBarcodes }
}
Expand Down Expand Up @@ -1042,7 +1042,7 @@ const buildElasticQueryForKeywords = function (params) {
query_string: {
fields: fieldMap._root,
query: escapeQuery(params.q),
default_operator: 'AND'
default_operator: 'OR'
}
})

Expand Down Expand Up @@ -1341,7 +1341,7 @@ const buildElasticQuery = function (params) {
match_phrase: {
'contributorLiteral.folded': {
query: querySansQuotes,
boost: 100
boost: 25
}
}
},
Expand All @@ -1352,6 +1352,14 @@ const buildElasticQuery = function (params) {
boost: 100
}
}
},
{
match_phrase: {
creatorModifiedName: {
query: querySansQuotes,
boost: 1000
}
}
}
])
}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/query-0063c9c99940d2fb617ace9ec6ae975b.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"body": {
"took": 7,
"took": 28,
"timed_out": false,
"_shards": {
"total": 2,
Expand Down
Loading

0 comments on commit e697a51

Please sign in to comment.