Add a pass-through search box to Vega
You can create a custom search box that integrates with your library website. You could do this to give patrons the option to search multiple places in addition to the library catalog, such as the library website, databases, or archives. Also, you have complete freedom over the design of the search mechanism.
To add a pass-through search box, include the code provided here on an appropriate webpage. You can use either pure HTML or pure JavaScript.
When you customize the script for your use, substitute the following value with your system setting:
| Value | Description |
| <FQDN> |
The fully-qualified domain name for your Vega site. This value can be found in your catalog URL. For example, in https://acpl.na4.iiivega.com/, the <FQDN> is acpl. This value is required. |
HTML
<!-- REQUIRED INPUT <FQDN> fully qualified domain name to Vega site -->
<form action="https://<FQDN>/search">
<input placeholder="What are you looking for?" name="query">
<select name="searchType">
<option value="everything">Everything</option>
<option value="agent">Author</option>
<option value="concept">Concept</option>
<option value="series">Series</option>
<option value="title">Title</option>
</select>
<input type="hidden" name="pageSize" value="10">
<input type="submit" value="Search">
</form>
Pure JavaScript
<!-- REQUIRED INPUT <FQDN> fully qualified domain name to Vega site -->
<div id="vega-search-box" data-url="https://<FQDN>"></div>
<script type="text/javascript">
var searchBox = document.getElementById('vega-search-box');
var endpoint = searchBox.getAttribute('data-url') + '/search';
var options = [
{
value: 'everything',
label: 'Everything'
},
{
value: 'agent',
label: 'Author'
},
{
value: 'concept',
label: 'Concept'
},
{
value: 'title',
label: 'Title'
}
];
var pageSize = 10;
function createOption(value, label) {
var option = document.createElement('option');
option.setAttribute('value', value);
option.innerHTML = label;
return option;
}
var form = document.createElement('form');
form.setAttribute('action', endpoint);
searchBox.appendChild(form);
var search = document.createElement('input');
search.setAttribute('placeholder', 'What are you looking for?');
search.setAttribute('name', 'query');
form.appendChild(search);
var type = document.createElement('select');
type.setAttribute('name', 'searchType');
form.appendChild(type);
var pageSizeInput = document.createElement('input');
pageSizeInput.setAttribute('type', 'hidden');
pageSizeInput.setAttribute('name', 'pageSize');
pageSizeInput.setAttribute('value', pageSize);
form.appendChild(pageSizeInput);
options.forEach(function(option) {
type.appendChild(createOption(option.value, option.label));
});
var submit = document.createElement('input');
submit.setAttribute('type', 'submit');
submit.setAttribute('value', 'search');
form.appendChild(submit);
</script>
Libraries that redirect users from their standard Discover catalog to the Central Request Interface catalog for interlibrary loan searches and circulation can use the following pass-through search URLs.
-
Keyword Search URL
https://HOST/search?query=##KEYWORD##&searchType=everything&pageSize=10&rapido=true -
Keyword Search for Title and Author from a single title view URL
https://HOST/search?query=##TITLE##%20AND%20##AUTHOR##&searchType=everything&pageSize=10&rapido=true -
Author Search URL
https://HOST/search?query=##AUTHOR##&searchType=agent&pageSize=10&rapido=true -
Title Search URL
https://HOST/search?query=##TITLE##&searchType=title&pageSize=10&rapido=true -
Series Title Search URL
https://HOST/search?query=smith&searchType=series&pageSize=10&rapido=true -
Subject Search URL
https://HOST/search?query=smith&searchType=concept&pageSize=10&rapido=true
The following code generates a search box that allows users to enter search terms and sends them directly to the Vega Central Request Interface catalog. The search returns matching Rapido interlibrary loan results. When a specific index is selected, the search is limited to that index, enabling targeted ILL searches.
HTML
<!-- REQUIRED INPUT <FQDN> fully qualified domain name to Vega Discover site -->
<form action="https://<FQDN>/search">
<input placeholder="What are you looking for?" name="query">
<select name="searchType">
<option value="everything">Everything</option>
<option value="agent">Author</option>
<option value="concept">Concept</option>
<option value="series">Series</option>
<option value="title">Title</option>
</select>
<input type="hidden" name="rapido" value="true">
<input type="hidden" name="pageSize" value="10">
<input type="submit" value="Search">
</form>
JavaScript
<!-- REQUIRED INPUT <FQDN> fully qualified domain name to Vega site -->
<div id="vega-search-box" data-url="https://<FQDN>"></div>
<script type="text/javascript">
var searchBox = document.getElementById('vega-search-box');
var endpoint = searchBox.getAttribute('data-url') + '/search';
var optionsSearchType = [
{ value: 'everything', label: 'Everything' },
{ value: 'agent', label: 'Author' },
{ value: 'concept', label: 'Concept' },
{ value: 'series', label: 'Series' },
{ value: 'title', label: 'Title' }
];
var pageSize = 10;
function createOption(value, label) {
var option = document.createElement('option');
option.setAttribute('value', value);
option.innerHTML = label;
return option;
}
var form = document.createElement('form');
form.setAttribute('action', endpoint);
searchBox.appendChild(form);
var search = document.createElement('input');
search.setAttribute('placeholder', 'What are you looking for?');
search.setAttribute('name', 'query');
form.appendChild(search);
var selectSearchType = document.createElement('select');
selectSearchType.setAttribute('name', 'searchType');
form.appendChild(selectSearchType);
optionsSearchType.forEach(function(option) {
selectSearchType.appendChild(createOption(option.value, option.label));
});
var rapidoInput = document.createElement('input');
rapidoInput.setAttribute('type', 'hidden');
rapidoInput.setAttribute('name', 'rapido');
rapidoInput.setAttribute('value', 'false');
form.appendChild(rapidoInput);
var pageSizeInput = document.createElement('input');
pageSizeInput.setAttribute('type', 'hidden');
pageSizeInput.setAttribute('name', 'pageSize');
pageSizeInput.setAttribute('value', pageSize);
form.appendChild(pageSizeInput);
var submit = document.createElement('input');
submit.setAttribute('type', 'submit');
submit.setAttribute('value', 'search');
form.appendChild(submit);
</script>