Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion config/qa.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ENCRYPTED_ELASTICSEARCH_URI=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAJYwgZMGCSqGSIb3DQEHBqCBhTCBggIBADB9BgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMIkDoQ9C/cCDCAq1wIBEIBQ+L3OgUGeOW9rs1CWkhpBjwM4LbbVRFIWedqew4UXIeSNMJ8cO9SNe4YGCUIoKwCDYt7W7ip3VtDRRRMVvz6QJw+Eg8ugTMVs2pbNFGNvaAQ=
RESOURCES_INDEX=resources-2025-07-07
SUBJECTS_INDEX=browse-qa-2025-10-27
SUBJECTS_INDEX=browse-qa-2026-01-15
ENCRYPTED_ELASTICSEARCH_API_KEY=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAJ4wgZsGCSqGSIb3DQEHBqCBjTCBigIBADCBhAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAx+kryf2KUmGdBYD9sCARCAV3ygz3eXIdq8JX/wpG9JRWlTNMRcpNE1qT0zNlN4t+ZvXEoedLQa/3p1YjgHw06GIAdA9xtkMV4eH9a1K8uCvjP8XxxNKekcMj59TlResnu9QF3r7pGXuQ==

ENCRYPTED_SCSB_URL=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAH8wfQYJKoZIhvcNAQcGoHAwbgIBADBpBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDBKllElmWYLxGOGopQIBEIA8JJyKde/8m8iCJGKR5D8HoTJhXHeyvw9eIDeuUNKiXLfJwoVz+PDAZSxkCQtM9O91zGhXbe3l6Bk1RlYJ
Expand Down
1 change: 0 additions & 1 deletion lib/elasticsearch/elastic-query-subjects-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class ElasticQuerySubjectsBuilder {
bool: {
should: [
{ match: { preferredTerm: { query: this.request.querySansQuotes(), operator: 'and', _name: 'preferredTerm' } } },
{ prefix: { preferredTerm: { value: this.request.querySansQuotes(), _name: 'preferredTermPrefix' } } },
{ nested: { path: 'variants', query: { match: { 'variants.variant': { query: this.request.querySansQuotes(), operator: 'and' } } }, inner_hits: {} } }
]
}
Expand Down
2 changes: 1 addition & 1 deletion lib/subjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = function (app, _private = null) {
uri: hit._source.uri
}
} else {
// Match was on a variant- use that in the response.
// Match was on a variant- use that in the response
const matchedVariantTerm = hit.inner_hits.variants.hits.hits[0]._source.variant

return {
Expand Down
14 changes: 4 additions & 10 deletions test/elastic-query-subjects-builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,31 @@ describe('ElasticQuerySubjectsBuilder', () => {

describe('search_scope="has"', () => {
it('applies subject match clauses to query', () => {
const request = new ApiRequest({ q: 'toast', search_scope: 'has' })
const request = new ApiRequest({ q: 'toast bread', search_scope: 'has' })
const inst = ElasticQuerySubjectsBuilder.forApiRequest(request)

const query = inst.query.toJson()

expect(query.bool.must[0].bool.should.length).to.equal(3)
expect(query.bool.must[0].bool.should.length).to.equal(2)
expect(query.bool.must[0].bool.should[0])
expect(query.bool.must[0].bool.should[0]).to.deep.equal({
match: {
preferredTerm: {
_name: 'preferredTerm',
query: 'toast',
query: 'toast bread',
operator: 'and'
}
}
})

expect(query.bool.must[0].bool.should[1]).to.deep.equal({
prefix: {
preferredTerm: { value: 'toast', _name: 'preferredTermPrefix' }
}
})

expect(query.bool.must[0].bool.should[2]).to.deep.equal({
nested: {
inner_hits: {},
path: 'variants',
query: {
match: {
'variants.variant': {
query: 'toast',
query: 'toast bread',
operator: 'and'
}
}
Expand Down