diff --git a/arches/app/media/js/views/components/search/search-results.js b/arches/app/media/js/views/components/search/search-results.js index 70a7d9efae3..3c05ca11a91 100644 --- a/arches/app/media/js/views/components/search/search-results.js +++ b/arches/app/media/js/views/components/search/search-results.js @@ -189,7 +189,7 @@ function($, _, BaseFilter, bootstrap, arches, select2, ko, koMapping, GraphModel return acc; }, []); - this.searchResults.results.hits.hits.forEach(function(result){ + this.searchResults.results.hits.hits.forEach(async function(result){ var graphdata = _.find(viewdata.graphs, function(graphdata){ return result._source.graph_id === graphdata.graphid; }); @@ -197,8 +197,14 @@ function($, _, BaseFilter, bootstrap, arches, select2, ko, koMapping, GraphModel if (result._source.points.length > 0) { point = result._source.points[0].point; } + + const thumbnailUrl = `/thumbnail/${result._source.resourceinstanceid}`; + const thumbnailResponse = arches.searchThumbnails == 'True' ? await fetch(thumbnailUrl, {method: 'HEAD'}): undefined; + const thumbnail = thumbnailResponse && thumbnailResponse.ok ? thumbnailUrl: undefined; + this.results.push({ displayname: result._source.displayname, + thumbnail: thumbnail, resourceinstanceid: result._source.resourceinstanceid, displaydescription: result._source.displaydescription, alternativelanguage: result._source.displayname_language != arches.activeLanguage, diff --git a/arches/app/templates/javascript.htm b/arches/app/templates/javascript.htm index 0a104475287..18e77eb577a 100644 --- a/arches/app/templates/javascript.htm +++ b/arches/app/templates/javascript.htm @@ -992,6 +992,7 @@ active-language="{{ app_settings.ACTIVE_LANGUAGE }}" active-language-dir="{{ app_settings.ACTIVE_LANGUAGE_DIR }}" languages='{{ app_settings.LANGUAGES }}' + search-thumbnails='{{ app_settings.SEARCH_THUMBNAILS }}' mapbox-api-key="{{ map_info.mapbox_api_key }}" mapbox-glyphs="{{ map_info.mapbox_glyphs }}" mapbox-sprites="{{ map_info.mapbox_sprites }}" diff --git a/arches/app/templates/views/components/search/search-results.htm b/arches/app/templates/views/components/search/search-results.htm index 87228660f75..a9a7acf94d5 100644 --- a/arches/app/templates/views/components/search/search-results.htm +++ b/arches/app/templates/views/components/search/search-results.htm @@ -5,19 +5,24 @@