- Created by Knut Anton Bøckman , last modified by Jakob K. Meile on Apr 04, 2022
You are viewing an old version of this content. View the current version.
Compare with Current View Version History
« Previous Version 24 Current »
Har du behov for at oprette en søgeboks, så brugerne kan søge direkte fra din side og få et resultat i Primo?
Du kan selv tilpasse indtastningsboksen og søgeknappen, så den passer din side.
Søgeboksen i eksemplerne herunder går til den engelske side - ændre evt name="lang" parameter til value="da" for at få den danske.
Grundlæggende søgeboks
Dette er den enkleste søgeboks du kan lave - den foretager en søgning i hele vores Primo:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Script that converts the query string into valid parameter --> <script type="text/javascript"> function searchPrimo() { document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " "); document.forms["searchForm"].submit(); } </script> </head> <body> <form id="simple" name="searchForm" method="get" target="_self" action="https://soeg.kb.dk/discovery/search?" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()"> <!-- Customizable Parameters --> <input type="hidden" name="vid" value="45KBDK_KGL:KGL"> <input type="hidden" name="tab" value="Everything"> <input type="hidden" name="search_scope" value="MyInst_and_CI"> <input type="hidden" name="lang" value="en"> <!-- Fixed parameters --> <input type="hidden" name="highlight" value="true"> <input type="hidden" name="dum" value="true"> <input type="hidden" name="query" id="primoQuery"> <input type="hidden" name="displayField" value="all"> <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard --> <input type="hidden" name="pcAvailabiltyMode" value="true"> <input type="text" id="primoQueryTemp" value="" size="35"> <!-- Search Button --> <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search" style="height: 22px; font-size: 12px; font-weight: bold; background: #002E70; color: #ffffff; border: 1px solid;"> </form> </body> </html>
Søgeboks med afgrænsning til en bestemt materialetype
Du kan også lave en søgeboks med forudvalgte facetter.
Her eksempel på en søgeboks med forudvalgt bøger som materialetype i Materialetype-facetten:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Script that converts the query string into valid parameter --> <script type="text/javascript"> function searchPrimo() { document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " "); document.forms["searchForm"].submit(); } </script> </head> <body> <form id="simple" name="searchForm" method="get" target="_self" action="https://soeg.kb.dk/discovery/search?" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()"> <!-- Customizable Parameters --> <input type="hidden" name="vid" value="45KBDK_KGL:KGL"> <input type="hidden" name="tab" value="Everything"> <input type="hidden" name="search_scope" value="MyInst_and_CI"> <input type="hidden" name="lang" value="en"> <!-- Fixed parameters --> <input type="hidden" name="highlight" value="true"> <input type="hidden" name="dum" value="true"> <input type="hidden" name="query" id="primoQuery"> <input type="hidden" name="facet" value="rtype,include,books"> <input type="hidden" name="displayField" value="all"> <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard --> <input type="hidden" name="pcAvailabiltyMode" value="true"> <input type="text" id="primoQueryTemp" value="" size="35"> <!-- Search Button --> <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search" style="height: 22px; font-size: 12px; font-weight: bold; background: #002E70; color: #ffffff; border: 1px solid;"> </form> </body> </html>
Søgeboks med afgrænsning til et bestemt bibliotek
Eksempel på en søgeboks med forudvalgt bibliotek i Biblioteks-facetten (her Roskilde Universitetsbibliotek).
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Script that converts the query string into valid parameter --> <script type="text/javascript"> function searchPrimo() { document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " "); document.forms["searchForm"].submit(); } </script> </head> <body> <form id="simple" name="searchForm" method="get" target="_self" action="https://soeg.kb.dk/discovery/search?" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()"> <!-- Customizable Parameters --> <input type="hidden" name="vid" value="45KBDK_KGL:KGL"> <input type="hidden" name="tab" value="Everything"> <input type="hidden" name="search_scope" value="MyInst_and_CI"> <input type="hidden" name="lang" value="en"> <!-- Fixed parameters --> <input type="hidden" name="highlight" value="true"> <input type="hidden" name="dum" value="true"> <input type="hidden" name="query" id="primoQuery"> <input type="hidden" name="facet" value="library,include,5763–188169280005763"> <input type="hidden" name="displayField" value="all"> <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard --> <input type="hidden" name="pcAvailabiltyMode" value="true"> <input type="text" id="primoQueryTemp" value="" size="35"> <!-- Search Button --> <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search" style="height: 22px; font-size: 12px; font-weight: bold; background: #002E70; color: #ffffff; border: 1px solid;"> </form> </body> </html>
Nummer til brug for biblioteksfacet indføres på listen over biblioteksnavne og -koder, efterhånden som de bliver efterspurgt.
Bemærk: hvis du laver en søgeboks til forudvalgt Bibliotek, omfatter søgeresultatet kun fysiske materialer
Søgeboks med "Sticky facet" - fastlåst filter
Ved at tilføje parameteren lk i facetafgrænsningen fra over, vil denne filtrering af resultatet fortsætte med næste søgning (indtil brugeren klikker "Fjern alle filtre" eller "Ny søgning")
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Script that converts the query string into valid parameter --> <script type="text/javascript"> function searchPrimo() { document.getElementById("primoQuery").value = "any,contains," + document.getElementById("primoQueryTemp").value.replace(/[,]/g, " "); document.forms["searchForm"].submit(); } </script> </head> <body> <form id="simple" name="searchForm" method="get" target="_self" action="https://soeg.kb.dk/discovery/search?" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo()"> <!-- Customizable Parameters --> <input type="hidden" name="vid" value="45KBDK_KGL:KGL"> <input type="hidden" name="tab" value="Everything"> <input type="hidden" name="search_scope" value="MyInst_and_CI"> <input type="hidden" name="lang" value="en"> <!-- Fixed parameters --> <input type="hidden" name="highlight" value="true"> <input type="hidden" name="dum" value="true"> <input type="hidden" name="query" id="primoQuery"> <input type="hidden" name="facet" value="library,include,5763–188169280005763,lk"> <input type="hidden" name="displayField" value="all"> <!-- Enable this if "Expand My Results" is enabled by default in Views Wizard --> <input type="hidden" name="pcAvailabiltyMode" value="true"> <input type="text" id="primoQueryTemp" value="" size="35"> <!-- Search Button --> <input id="go" title="Search" onclick="searchPrimo()" type="button" value="Search" alt="Search" style="height: 22px; font-size: 12px; font-weight: bold; background: #002E70; color: #ffffff; border: 1px solid;"> </form> </body> </html>
Kontakt Knut Anton Bøckman eller Karen Strandgaard for spørgsmål til søgebokse og for information om input til facetafgrænsninger.
- No labels