Can I embed my Arca search box in another site?

To embed an Arca search box in your library website or elsewhere, just paste this code wherever you want to embed it, and edit MY_SITE to your domain (e.g. mysite.arcabc.ca):

<div class="front-search-box">
<form action="https://MY_SITE/islandora/search/?type=edismax" method="post" accept-charset="UTF-8"><div><div class="container-inline form-wrapper" id="edit-simple"><h1></h1><div class='front-description-wrapper'><p class='simple-search-text'>Search MY_SITE's collection</p></div><div class="form-item form-type-textfield form-item-islandora-simple-search-query">
<label class="element-invisible" for="edit-islandora-simple-search-query">Search Term </label>
<input placeholder="Search All Collections" type="text" id="edit-islandora-simple-search-query" name="islandora_simple_search_query" value="" size="15" maxlength="128" class="form-text" />
</div>
<input type="submit" id="edit-submit" name="op" value="Search" class="form-submit" /><div class='adv-search-lnk'><a href="https://MY_SITE/advanced-search" class="adv_search">Advanced Search</a></div><div class="front-menu-wrapper"></div></div>
<input type="hidden" name="form_id" value="islandora_solr_simple_search_form" />
</div></form> </div>

If you want to limit your search to a particular collection or add some other restrictions, BCRDH have come up with this additional piece that uses Javascript to insert extra parameters to the query. Place this snippet before the search box code. Edit to replace "MY_SITE" with your site's URL, SOME_SOLR_FIELD with the Solr field you want to use (e.g. RELS_EXT_isMemberOfCollection_uri_ms) and "Solr Field Content" with the value of that field, e.g. your collection's PID.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
//load search result page 
$(document).ready(function(){     
  $("#edit-submit").click(function(){         
    //get search string from form         
    var searchString = $('#edit-islandora-simple-search-query').val();
    //restrict to a particular collection and open search result url
    var queryURL = "https://MY_SITE/islandora/search/" + searchString + "?type=dismax&islandora_solr_search_navigation=1&f%5B0%5D=SOME_SOLR_FIELD%3A%22Solr Field Content%22"
      window.open(queryURL); return false;
    });
}); 
//end jquery Script 
</script>

Category: