Setting up a Site-specific Search

The PSOM search engine uses the MindBreeze search engine which indexes both www.med.upenn.edu and pennmedicine.org. To set up a custom search of your site(s) on www.med.upenn.edu, follow the instructions below.

Setting up a single search page

For use when the search box and results are displayed ONLY on a single search page.

  1. Create a search page ("search.html"), if one does not already exist.
  2. Add the js library and GSA search plugin inside the <head> tags on the search page.

      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> 
      <script src="//www.med.upenn.edu/js/jquery.gsaEmbed.js"></script>

  3. Add code below in the content area of your search page to display the search results. A div is created from the javascript ID given to show search results on the page.

    <div id="gsa_search"></div>

  4. Add the following script after the </body> tag to generate the search results.

    <script> 
      jQuery(document).ready(function($){ 
        $('#gsa_search').gsaEmbed(); 
      }); 
    </script> 

  5. Search result page example:

    <!DOCTYPE html> 

    <head> 
      <meta charset="utf-8"> 
      <title>Search Results | Site Name | Perelman School of Medicine at the University of Pennsylvania</title>  
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
      <script src="//www.med.upenn.edu/js/jquery.gsaEmbed.js"></script>  
    </head> 

    <body> 
      <div id="gsa_search"></div>
    </body> 

    <script> 
    jQuery(document).ready(function($){ 
      $('#gsa_search').gsaEmbed(); 
    }); 
    </script>

    </html>

  6. Example of a site using a single search page: PMACS web site

Setting up a search form on multiple pages with a single search results page

For use when the search box and results are displayed on different pages — e.g., when you want the search box to appear on all pages of your site with the results displaying on a separate page.

  1. Create a new page for the search results (follow the same instructions for "single search page" above). Save the page as "results.html" (as it corresponds to search form code).
  2. Include search form code in html according to where the search box is intended to be placed — e.g., the header where the search form will display on multiple pages.
    <form action="results.html" method="get">
      
    <input type="text" name="query" /> 
      <input type="submit" name="form_submit" value="Search" />
    </form>
  3. Example of a site using a search box on a separate page from the search results page: Perelman School of Medicine website

Search customization options

Limit number of results per page

Add the following code to the javascript call for the search to specify the # of results per page.
Note: any additional results will paginate.

'resultsPerPage': #

Example:

<script> 
jQuery(document).ready(function($){ 
  $('#gsa_search').gsaEmbed({ 
    'resultsPerPage': 1 
  }); 
}); 
</script>

Restrict search results to one specific URL (default will search all of www.med)

Add the following code to the javascript call for the search to specify the URL(s) to search.

'searchUrls': 'https://www.med.upenn.edu/department-name'

Restrict search to several URLs.

'searchUrls': 'https://www.med.upenn.edu/department-name,https://www.med.upenn.edu/department-name2'

Example:

<script> 
jQuery(document).ready(function($){ 
  $('#gsa_search').gsaEmbed({ 
    'searchUrls': 'https://www.med.upenn.edu/pmacswebteam' 
  });
});
</script>

Define options to select which URL to search

Add the following code to the javascript call for the search to have the option to search per URL.
Note: defining the searchUrlOptions will generate the options in the HTML markup.

'searchUrlOptions': { 
  'Name/title of URL': 'http://www.med.upenn.edu/department', 
  'Name/title of URL': 'http://www.med.upenn.edu/department2' 
}

Example:

<script> 
jQuery(document).ready(function($){ 
  $('#gsa_search').gsaEmbed({ 
    'searchUrlOptions': { 
    'Dept. of Psych':'http://www.med.upenn.edu/psychiatry', 
    'Perelman School of Medicine': 'http://www.med.upenn.edu' 
    } 
  }); 
}); 
</script>

If you have any questions, please contact PMACS.