@@ -4,20 +4,26 @@ const BASE_URL = "https://api.finna.fi";
44
55module . exports = {
66 async getImagesFromFinnaWithTitle ( topic , lat , lon , maxradius ) {
7+
8+ let query = '"' + JSON . parse ( topic ) . join ( '" OR "' ) + '"' ;
79
810 //construct query
911 const requestConfig = {
1012 baseURL : BASE_URL + "/" ,
1113 url : "/v1/search" ,
1214 method : "get" ,
1315 params : {
14- lookfor : topic ,
16+ lookfor : query ,
1517 type : 'AllFields' ,
1618 limit : 100 ,
17- "filter[0]" : '~format:"0/Image/"' ,
18- "filter[1]" : '~format:"0/WorkOfArt/"' ,
19- "filter[2]" : 'usage_rights_str_mv:"usage_E"' ,
20- "filter[3]" : 'online_boolean:"1"' ,
19+ //"filter[0]": '~format:"0/Image/"',
20+ //"filter[1]": '~format:"0/WorkOfArt/"',
21+ //"filter[2]": 'usage_rights_str_mv:"usage_E"',
22+ //"filter[0]": 'free_online_boolean:"1"',
23+ 'filter[0]' : '~format_ext_str_mv:"0/Image/"' ,
24+ 'filter[1]' : '~format_ext_str_mv:"0/Map/"' ,
25+ 'filter[2]' : '~format_ext_str_mv:"0/WorkOfArt/"' ,
26+ 'filter[3]' : 'free_online_boolean:1' ,
2127 "field[0]" : 'id' ,
2228 "field[1]" : 'title' ,
2329 "field[2]" : 'geoLocations' ,
@@ -138,32 +144,33 @@ module.exports = {
138144
139145 //assign data to metadata properties
140146 var image = {
141- id : record . id ,
142- inventoryNumber : record . identifierString ,
143- source : "Finna" ,
144- title : [ ] ,
145- geoLocations : ( record . geoLocations != undefined ? record . geoLocations : [ ] ) ,
146- measurements : record . measurements ,
147- materials : materials ,
148- imageURL : BASE_URL + record . images [ 0 ] ,
149- thumbURL : thumbURL ,
150- formats : formats ,
151- year : ( record . year != undefined ? parseInt ( record . year , 10 ) : null ) ,
152- publisher : ( record . publisher != undefined ? record . publisher : null ) ,
153- // authors: authors,
154- creators : record . nonPresenterAuthors ,
155- institutions : [ ] ,
156147 actors : record . subjectActors ,
157- details : record . subjectDetails ,
158- subjects : subjects ,
159- places : record . subjectPlaces ,
160148 collection : collection ,
161- imageRights : record . imageRights ,
162- license : ( record . imageRights != undefined ? record . imageRights . copyright : "" ) ,
149+ creators : record . nonPresenterAuthors ,
150+ creditline : record . imagesExtended [ 0 ] . rights . creditline ,
151+ datecreated : datecreated ,
163152 description : record . summary ,
153+ details : record . subjectDetails ,
154+ downloadURL : '' ,
155+ formats : formats ,
156+ geoLocations : ( record . geoLocations != undefined ? record . geoLocations : [ ] ) ,
157+ id : record . id ,
158+ imageURL : BASE_URL + record . images [ 0 ] ,
164159 infoURL : "https://www.finna.fi/Record/" + encodeURIComponent ( record . id ) ,
165160 inscriptions : record . inscriptions ,
166- datecreated : datecreated
161+ institutions : [ ] ,
162+ inventoryNumber : record . identifierString ,
163+ license : ( record . imageRights != undefined ? record . imageRights . copyright : "" ) ,
164+ materials : materials ,
165+ measurements : record . measurements ,
166+ places : record . subjectPlaces ,
167+ publisher : ( record . publisher != undefined ? record . publisher : null ) ,
168+ rightsstatement : '' ,
169+ source : "Finna" ,
170+ subjects : subjects ,
171+ thumbURL : thumbURL ,
172+ title : [ ] ,
173+ year : ''
167174 }
168175
169176 if ( record . title ) {
@@ -176,6 +183,10 @@ module.exports = {
176183 }
177184 }
178185
186+ if ( record . year != undefined ) {
187+ image . year = parseInt ( record . year , 10 ) ;
188+ }
189+
179190 images . push ( image ) ;
180191 }
181192 }
0 commit comments