Skip to content

Commit

Permalink
Updated standard_number search
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Jun 13, 2024
1 parent 3d808c3 commit ab04699
Show file tree
Hide file tree
Showing 31 changed files with 9,254 additions and 9,573 deletions.
60 changes: 13 additions & 47 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ const buildElasticQuery = function (params) {
}
])
}

if (['contributor'].includes(params.search_scope)) {
query.bool.should = query.bool.should.concat([
{
Expand All @@ -1355,64 +1356,29 @@ const buildElasticQuery = function (params) {
])
}

/*
if (['standard_number'].includes(params.search_scope)) {
if (params.search_scope === 'standard_number') {
query.bool.should = query.bool.should.concat([
{ prefix: { idIsbn: { value: querySansQuotes } } },
{ prefix: { idLccn: { value: querySansQuotes } } },
{ prefix: { idOclc: { value: querySansQuotes } } },
{
nested: {
path: 'items',
query: {
match_phrase: {
'items.shelfMark.raw': {
query: querySansQuotes,
boost: 50
}
}
}
}
},
{
nested: {
path: 'items',
query: {
prefix: {
'items.shelfMark.raw': {
value: querySansQuotes,
boost: 25
}
}
}
}
},
{
nested: {
path: 'items',
query: {
term: {
'items.shelfMark.raw': {
value: querySansQuotes,
boost: 105
}
}
prefix: {
'shelfMark.raw': {
value: querySansQuotes,
boost: 10
}
}
},
{
nested: {
path: 'items',
query: {
term: {
'items.idBarcode': {
value: querySansQuotes,
boost: 105
}
}
term: {
'shelfMark.raw': {
value: querySansQuotes,
boost: 50
}
}
}
])
}
*/
}

const advancedParamQueries = ADVANCED_SEARCH_PARAMS
Expand Down
33 changes: 17 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
{
"body": {
"took": 29,
"took": 306,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"skipped": 0,
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"total": 1,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_index": "resources-2018-04-09",
"_type": "resource",
"_id": "b22144813",
"_score": 49.89173,
"_score": 17.845865,
"_source": {
"extent": [
"1234, [1] pages, x leaves : illustrations ;",
Expand Down Expand Up @@ -736,31 +733,23 @@
]
},
"sort": [
49.89173,
17.845865,
"b22144813"
],
"inner_hits": {
"electronicResources": {
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"total": 0,
"max_score": null,
"hits": []
}
},
"items": {
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"total": 2,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 0
Expand Down Expand Up @@ -864,8 +853,6 @@
]
},
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
{
"body": {
"took": 68,
"took": 617,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"skipped": 0,
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"total": 1,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_index": "resources-2018-04-09",
"_type": "resource",
"_id": "b22144813",
"_score": 26.280298,
"_score": 17.58589,
"_source": {
"extent": [
"1234, [1] pages, x leaves : illustrations ;",
Expand Down Expand Up @@ -736,31 +733,23 @@
]
},
"sort": [
26.280298,
17.58589,
"b22144813"
],
"inner_hits": {
"electronicResources": {
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"total": 0,
"max_score": null,
"hits": []
}
},
"items": {
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"total": 2,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 0
Expand Down Expand Up @@ -864,8 +853,6 @@
]
},
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
{
"body": {
"took": 52,
"took": 577,
"timed_out": false,
"_shards": {
"total": 2,
"successful": 2,
"skipped": 0,
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"total": 1,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_index": "resources-2018-04-09",
"_type": "resource",
"_id": "b22144813",
"_score": 26.280298,
"_score": 33.585762,
"_source": {
"extent": [
"1234, [1] pages, x leaves : illustrations ;",
Expand Down Expand Up @@ -736,31 +733,23 @@
]
},
"sort": [
26.280298,
33.585762,
"b22144813"
],
"inner_hits": {
"electronicResources": {
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"total": 0,
"max_score": null,
"hits": []
}
},
"items": {
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"total": 2,
"max_score": null,
"hits": [
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 0
Expand Down Expand Up @@ -864,8 +853,6 @@
]
},
{
"_index": "resources-2024-06-07",
"_id": "b22144813",
"_nested": {
"field": "items",
"offset": 1
Expand Down
Loading

0 comments on commit ab04699

Please sign in to comment.