Primo Search Boxes

Primo Search Boxes


Jim LeFager
Hi All, 

We have created example Primo search boxes for all institutions that can be included in your website and other web properties.  I've attached a Zip file that contains HTML files with search box code for all institutions, labeled by institution code.   


  • Each search box will perform a search across the default tab and scope for your institution and also includes the Production CName. 
  • Each html file has the base code for the form, so any styling and branding can be applied as needed.  
  • In order to target the correct Primo view, the code within the search box will need to include the Institution Code, View ID,  tab code, and search scope.  
  • You can find the values for the tabs and scopes within the url of Primo - **See Attached Screenshot




If there are questions or requests pertaining to the Primo Search boxes, please open a SalesForce case.  

Thanks, 

Jim


CalState Search Boxes.zip
22 KB


Steven Orr

Steven Orr 
I appreciate you preparing this code. After looking at the different hidden form fields, I thought i might be able to send a query to one of the different tabs...say, for instance "course_reserves"...just by changing the "tab" parameter (&tab=course_reserves) but it doesn't work. 


Must I also change the scope parameter (&search_scope=EVERYTHING) or what do you suggest?


Ryan Schwab

Ryan Schwab 
You do have to change both. Some tabs have multiple scopes too, so you might need further customization. Here's what my javascript file looks like:


function searchPrimo() {
    document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " ");
    document.forms["OnesearchForm"].submit();
}

function primoScopeSwitch(scope) {
    switch(scope.value) {
        case "everything":
        document.getElementById("primoTab").value = "everything";
        document.getElementById("primoScope").value = "Everything";
        document.getElementById("primoQueryTemp").placeholder = "Discover books, articles, videos, and more";
        break;

        case "chico":
        document.getElementById("primoTab").value = "default_tab";
        document.getElementById("primoScope").value = "01CALS_CHI";
        document.getElementById("primoQueryTemp").placeholder = "Search items found here in the library";
        break;
    
        case "csu":
        document.getElementById("primoTab").value = "csu_nz";
        document.getElementById("primoScope").value = "01CALS";
        document.getElementById("primoQueryTemp").placeholder = "Find items from all CSU libraries";
        break;

        case "articles":
        document.getElementById("primoTab").value = "articles";
        document.getElementById("primoScope").value = "PRIMO_CENTRAL";
        document.getElementById("primoQueryTemp").placeholder = "Search databases and peer reviewed journals";
        break;
    }
}

I added ID's to the tab and scope hidden fields so this would work. Ours utilizes a select dropdown (with id scopeSelecter) that fires the scope switch function onchange. Then when the dom loads I run:

var scope = document.getElementById("scopeSelecter"); 
          primoScopeSwitch(scope);


Jim LeFager

Jim LeFager 
Hi , 

Ryan is correct in that you will need to specify both a tab code and a scope code.  Depending on the configuration in Primo, you may have a combination of scopes and tabs so for this reason they will both need to be identified in the form. 

Nice code by the way Ryan. 


Jim