Skip to content

Commit

Permalink
Add Elastic consultant query additions
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed May 30, 2024
1 parent ef3d5a0 commit be68cd7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
contents: read
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/qa-node20'
if: github.ref == 'refs/heads/qa-node20-es-tuning'
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion config/qa.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Greg built self-hosted production domain:
ENCRYPTED_ELASTICSEARCH_URI=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHgwdgYJKoZIhvcNAQcGoGkwZwIBADBiBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDIYpOz/BbRlJZUul7gIBEIA1idumQ6fdf/j5/pzF4t96MGGH/eV1gD4WCyLUnScgNYqtRNK0ajRO6XVroswsrJtgCwUerDM=
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHIwcAYJKoZIhvcNAQcGoGMwYQIBADBcBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDHuuuG/vsNVvjm2BgIBEIAvNe+XrgVv1D1W1WLqvsTWrCET7oK3/LlvfcQwFWIW0W4dONlDbU9UXrlufonpJ5M=
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHIwcAYJKoZIhvcNAQcGoGMwYQIBADBcBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFVXv05VtUwVtXit3wIBEIAv7GbABuJ+cOEA7ZqVzPEdL6zGytekVKeQnh4z50B2RXXsUKlMUz6osvh6S4koOYY=

ENCRYPTED_SCSB_URL=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAH8wfQYJKoZIhvcNAQcGoHAwbgIBADBpBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDBKllElmWYLxGOGopQIBEIA8JJyKde/8m8iCJGKR5D8HoTJhXHeyvw9eIDeuUNKiXLfJwoVz+PDAZSxkCQtM9O91zGhXbe3l6Bk1RlYJ
ENCRYPTED_SCSB_API_KEY=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGMwYQYJKoZIhvcNAQcGoFQwUgIBADBNBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDNw8KXkyN8HvtjAX0gIBEIAgX+XG2fxTj6kSchrd/dfHB05KU5pkT0LtPxUTuNCXoLc=
Expand Down
49 changes: 48 additions & 1 deletion lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ const buildElasticBody = function (params) {
query
}
}
body.min_score = 0.65
body.min_score = 1.65
body.sort = ['_score']

// just filters: no score
Expand Down Expand Up @@ -1225,6 +1225,53 @@ const buildElasticQuery = function (params) {
if (params.q) {
// Merge keyword-specific ES query into the query we're building:
query.bool = { must: [buildElasticQueryForKeywords(params)] }

// Mike, Elastic consultant, additions:
query.bool.should = []
query.bool.should.push({
term: {
nyplSource: {
value: 'sierra-nypl',
boost: 1
}
}
})
if (['all', 'title'].includes(params.search_scope)) {
query.bool.should.push({
prefix: {
'title.keyword': {
value: params.q,
boost: 100
}
}
})
query.bool.should.push({
term: {
'title.keyword': {
value: params.q,
boost: 105
}
}
})
}
if (['all', 'contributor'].includes(params.search_scope)) {
query.bool.should.push({
prefix: {
'contributorLiteral.keyword': {
value: params.q,
boost: 100
}
}
})
query.bool.should.push({
term: {
'contributorLiteral.keyword': {
value: params.q,
boost: 105
}
}
})
}
}

const advancedParamQueries = ADVANCED_SEARCH_PARAMS
Expand Down

0 comments on commit be68cd7

Please sign in to comment.