@@ -37,75 +37,6 @@ const {
3737
3838const RESOURCES_INDEX = process . env . RESOURCES_INDEX
3939
40- << < << << scc - 5050 - 2
41- === = ===
42- const ITEM_FILTER_AGGREGATIONS = {
43- item_location : { nested : { path : 'items' } , aggs : { _nested : { terms : { size : 100 , field : 'items.holdingLocation_packed' } } } } ,
44- item_status : { nested : { path : 'items' } , aggs : { _nested : { terms : { size : 100 , field : 'items.status_packed' } } } } ,
45- item_format : { nested : { path : 'items' } , aggs : { _nested : { terms : { size : 100 , field : 'items.formatLiteral' } } } }
46- }
47-
48- // Configure sort fields:
49- const SORT_FIELDS = {
50- title : {
51- initialDirection : 'asc' ,
52- field : 'title_sort'
53- } ,
54- date : {
55- initialDirection : 'desc' ,
56- field : 'dateStartYear'
57- } ,
58- creator : {
59- initialDirection : 'asc' ,
60- field : 'creator_sort'
61- } ,
62- relevance : { }
63- }
64-
65- // The following fields can be excluded from ES responses because we don't pass them to client:
66- const EXCLUDE_FIELDS = [
67- 'uris' ,
68- '*_packed' ,
69- '*_sort' ,
70- 'items.*_packed' ,
71- 'contentsTitle' ,
72- 'suppressed' ,
73- // Hide contributor and creator transformed fields:
74- '*WithoutDates' ,
75- '*Normalized'
76- ]
77-
78- // Configure controller-wide parameter parsing:
79- const parseSearchParams = function ( params , overrideParams = { } ) {
80- return parseParams ( params , {
81- q : { type : 'string' } ,
82- page : { type : 'int' , default : 1 } ,
83- per_page : { type : 'int' , default : 50 , range : [ 0 , 100 ] } ,
84- field : { type : 'string' , range : Object . keys ( AGGREGATIONS_SPEC ) } ,
85- sort : { type : 'string' , range : Object . keys ( SORT_FIELDS ) , default : 'relevance' } ,
86- sort_direction : { type : 'string' , range : [ 'asc' , 'desc' ] } ,
87- search_scope : { type : 'string' , range : Object . keys ( SEARCH_SCOPES ) , default : 'all' } ,
88- filters : { type : 'hash' , fields : FILTER_CONFIG } ,
89- items_size : { type : 'int' , default : 100 , range : [ 0 , 200 ] } ,
90- items_from : { type : 'int' , default : 0 } ,
91- callnumber : { type : 'string' } ,
92- standard_number : { type : 'string' } ,
93- contributor : { type : 'string' } ,
94- title : { type : 'string' } ,
95- subject : { type : 'string' } ,
96- subject_prefix : { type : 'string' } ,
97- isbn : { type : 'string' } ,
98- issn : { type : 'string' } ,
99- lccn : { type : 'string' } ,
100- oclc : { type : 'string' } ,
101- role : { type : 'string' } ,
102- merge_checkin_card_items : { type : 'boolean' , default : true } ,
103- include_item_aggregations : { type : 'boolean' , default : true } ,
104- ...overrideParams
105- } )
106- }
107-
108- >>> > >>> main
10940// These are the handlers made available to the router:
11041module . exports = function ( app , _private = null ) {
11142 app . resources = { }
0 commit comments