Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    How to - Add links to additional search platforms in Primo Brief Results

    Created By: François Renaville
    Created on: 12/06/2019



    Goal: Support ease of further discovery beyond Primo by adding in a new Facet with links to preferred external platforms, such as Google Scholar, PubMed, and Scopus. The links incorporate the user's initial search query in Primo, as a rebound query into the destination platform. The following code has strongly been inspired by what has been done at Purdue (example).

    At the University of Liège Library, we have added eight rebound possibilities displayed in the alphabetical order (example) at the bottom of the facets (example):

    • 2 Open Access aggregators (BASE, ISIDORE)
    • 2 major databases (Scopus, PubMed)
    • 2 academic search engines (Google Scholar, Microsoft Academic)
    • 2 local catalogs (legacy homemade search engine for old library catalog cards [Scribe] and Belgian union catalog UniCat)

    Each external resource has its own logo on the left and some of them have an additional icon on the right.

     

     

    Step 1

    Create an html file named externalSearch.html in your html folder (Cutomization Package) and put the following code that can be downloaded from https://img.lib.uliege.be/~frenaville/ExLibris_CommunityKnowlegde/Primo_ExternalSearch/externalSearch.txt

    Note:

    • The name given in line 1 (here: Find it @...) will have to match the name given in custom.js.
    • target.img will be used to display the external resource icon on the left. We apply a 21x21 size.
    • target.img_2 will be used to display the additional icon on the right of the resource name. No size is given here since each icon used will have its own size.

     

    Step 2

    Add the icons you want to use in the img folder (Cutomization Package).

    Ours are available here : https://img.lib.uliege.be/~frenaville/ExLibris_CommunityKnowlegde/Primo_ExternalSearch/img.zip

    There are:

    • 8 resource icons
    • 1 Open Access icon (16x16)
    • 1 icon representing our institutional logo (18x16)
    • 1 placeholder icon (transparent, 1x1) that is used when there is no icon to display on the right

     

    Step 3

    In custom.js, make sure that your view is defined as LOCAL_VID and that externalSearch is added as a parameter for 'viewCustom'.

    By using LOCAL_VID, it will be much easier to reuse the code in different views

    Our code is the following:

    (function () {
      "use strict";
      'use strict';
      var app = angular.module('viewCustom', ['angularLoad', 'externalSearch']);
      var LOCAL_VID = "32ULG_INST-ULIEGE";

    ...

    })

     

    Step 4

    Add the following code to the custom.js. Just remove the targets you don’t want or replace them by other targets.

    Note:

    • The name used for facetTitle must be the same used in externalSearch.html (here: Find it @...).
    • img will be associated to the resource icon while img_2 will be associated to the icon to display on the right of the resource name: either the Open Access button [logo_oa.png], the institutional logo [logo_uliege.png] or the dummy transparent placeholder icon [logo_placeholder.png].
     /** externalSearch **/
      app.component('prmFacetExactAfter', {
        bindings: { parentCtrl: '<' },
        template: '<external-search></external-search>'
      });
    
      angular.module('externalSearch', []).value('searchTargets', []).directive('externalSearch', function () {
        return {
          require: '^^prmFacet',
          restrict: 'E',
          templateUrl: '/discovery/custom/' + LOCAL_VID + '/html/externalSearch.html',
          controller: ['$scope', '$location', 'searchTargets', function ($scope, $location, searchTargets) {
            $scope.name = $scope.$ctrl.parentCtrl.facetGroup.name;
            $scope.targets = searchTargets;
            var query = $location.search().query;
            var filter = $location.search().pfilter;
            $scope.queries = Array.isArray(query) ? query : query ? [query] : false;
            $scope.filters = Array.isArray(filter) ? filter : filter ? [filter] : false;
          }],
          link: function link(scope, element, attrs, prmFacetCtrl) {
            var facetTitle = 'Find it @...';
            var found = false;
            for (var facet in prmFacetCtrl.facets) {
              if (prmFacetCtrl.facets[facet].name === facetTitle) {
                found = true;
              }
            }
            if (!found) {
              prmFacetCtrl.facets.push({
                name: facetTitle,
                displayedType: 'exact',
                limitCount: 0,
                facetGroupCollapsed: false,
                values: []
              });
            }
          }
        };
      });
    
      app.value('searchTargets', [{
        "name": "BASE",
        "url": "http://www.base-search.net/Search/Results?l=en&type=all&lem=0&lem=1&refid=dcbasen&lookfor=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-base.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_oa.png",
        "alt": "BASE",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "Google Scholar",
        "url": "https://scholar.google.com/scholar?q=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-googlescholar.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_placeholder.png",
        "alt": "Google Scholar",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "ISIDORE",
        "url": "https://isidore.science/s?q=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-isidore.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_oa.png",
        "alt": "ISIDORE",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "Microsoft Academic",
        "url": "https://academic.microsoft.com/#/search?",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-microsoft_academic.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_placeholder.png",
        "alt": "icrosoft Academic",
        mapping: function mapping(queries, filters) {
          try {
            var termquery = queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
            return "iq=@" + termquery + "@&q=" + termquery + "&filters=&from=0&sort=0";
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "PubMed",
        "url": "https://pubmed.ncbi.nlm.nih.gov/?otool=ibeudlmlib&term=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-pubmed.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_placeholder.png",
        "alt": "PubMed",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "Scopus",
        "url": "http://www.scopus.com/results/results.uri?src=s&sot=b&sdt=b&sl=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-scopus.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_placeholder.png",
        "alt": "Scopus",
        mapping: function mapping(queries, filters) {
          try {
            var termquery = "TITLE-ABS-KEY(" + queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ') + ")";
            return termquery.length + "&s=" + termquery;
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "Scribe",
        "url": "http://scribe.ulg.ac.be/html/recherches.php?fichier=1&type_r=tout_et&auteur=&s1=OU&find2&etousauf=ET&find3=&s3=OU&find4=&tiroir=001&nnnn=&nb_affich=20&oper=recherche&mode=public&find1=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-scribe.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_uliege.png",
        "alt": "Scribe",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }, {
        "name": "UniCat",
        "url": "https://www.unicat.be/uniCat?func=search&uiLanguage=en&query=",
        "img": "/discovery/custom/" + LOCAL_VID + "/img/logo-unicat.png",
        "img_2": "/discovery/custom/" + LOCAL_VID + "/img/logo_placeholder.png",
        "alt": "UniCat",
        mapping: function mapping(queries, filters) {
          try {
            return queries.map(function (part) {
              return part.split(",")[2] || "";
            }).join(' ');
          } catch (e) {
            return '';
          }
        }
      }]);
    
      /** END externalSearch **/
    

     

    Contact: Sylvain Danhieux S.Danhieux {@} uliege (.) be ; François Renaville francois.renaville {@} uliege (.) be