Skip to content

Commit

Permalink
Fix broken standard-number searches
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Jul 13, 2024
1 parent 495fc06 commit 8d30e90
Show file tree
Hide file tree
Showing 56 changed files with 18,925 additions and 30,763 deletions.
45 changes: 40 additions & 5 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -1443,11 +1443,46 @@ const buildElasticQuery = function (params) {
// ['shelfMark', 'identifierV2.value', 'uri', 'identifier', 'items.shelfMark', { field: 'items.idBarcode', on: (q) => /\d{6,}/.test(q) }, 'idIsbn_clean']
if (params.search_scope === 'standard_number') {
query.bool.should = query.bool.should.concat([
{ prefix: { 'identifierV2.value': namedQuery({ value: querySansQuotes }, 'term identifierV2.value') } },
{ term: { uri: namedQuery({ value: querySansQuotes }, 'term uri') } },
{ prefix: { idIsbn: namedQuery({ value: querySansQuotes }, 'prefix idIsbn') } },
{ prefix: { idLccn: namedQuery({ value: querySansQuotes }, 'prefix idLccn') } },
{ prefix: { idOclc: namedQuery({ value: querySansQuotes }, 'prefix idOclc') } },
{
prefix: {
'identifierV2.value': namedQuery({
value: querySansQuotes,
boost: 10
}, 'term identifierV2.value')
}
},
{
term: {
uri: namedQuery({
value: querySansQuotes,
boost: 10
}, 'term uri')
}
},
{
prefix: {
idIsbn: namedQuery({
value: querySansQuotes,
boost: 10
}, 'prefix idIsbn')
}
},
{
prefix: {
idLccn: namedQuery({
value: querySansQuotes,
boost: 10
}, 'prefix idLccn')
}
},
{
prefix: {
idOclc: namedQuery({
value: querySansQuotes,
boost: 10
}, 'prefix idOclc')
}
},
{
prefix: {
'shelfMark.raw': namedQuery({
Expand Down
Loading

0 comments on commit 8d30e90

Please sign in to comment.