skip to primary navigationskip to content
 

Setting up search boxes

JML to check encoding section

Introduction

The search service at search.cam.ac.uk can be used to search University-wide or to search specific servers (or parts of servers). It can therefore be used by webmasters around the University to provide a search facility for their servers or for specific collections of information on their servers without the need to run search software locally, assuming that the servers are being indexed for searching and that the scope of the indexing and the available search facilities meet their needs. If you are unsure whether your web content is being indexed, email telling us the URLs of the web content concerned.

The search service at search.cam.ac.uk will search the whole University index. It allows the following:

  • authorised users are able to set up filtered searches.
  • the search constraints are for institution (name="inst") and a search tag (name="tag") that refers to a list of urls that should be searched.

The pages that access the functionality for adding search filters for your institution may be found by following the 'Administer Search' link in the top right of the search interface screen (http://search.cam.ac.uk/), which you will see if you already have editing rights for the Lookup "Editors Group" for your institution. If you don't see this link, you have three choices:

  • get these editing rights
  • ask a person who has editing rights to set up a search tag for you
  • use dynamic search filters instead of assigning the search to your institution

To find your local contact, go to Lookup, search for your institution, go to the 'Groups' tab, and select "Editors group for 'your institution'", where you will see a contact name and link to details. You can request to join this group by sending email to this contact, explaining why you need to join or asking them to set up the search tag for you. If you are running a web server that is not part of the institution to which you belong, contact with details, and we'll try to help.

Defining what is searched using the search interface

Once you have editing rights and you follow the 'Administer Search' link, you will see the following screen (but showing your institution where the arrow indicates rather than "University of Cambridge"):

search admin

If you follow the link (or links) to view or edit search filters, you will see a screen for "Website Search Filters", containing any existing filters and below these a button "Add a new search filter".

Editing existing filters

Any existing filters from the 'old' search were partly imported into the new, but some will need completing before they can be used. When constructing search boxes, a filter is identified by an institution and a search tag. You must supply a search tag for a filter in order to use it in this manner. In some cases tags will have been derived from the old packaged searches; you can use these or invent your own. When you look at the existing filters your institution has you'll see a filter labelled '(main institution website)'. This filter alone does not need a tag (but you may add one if you wish) but you should edit any other filters to add an appropriate tag, and then they will be ready to use.

Adding a new filter

When you add a new filter you will see a screen like the following, into which you must add four pieces of information:

new uis filter

  • Main filter: Whether this filter is to be the main one for the institution
  • Title: The title of the filter (which may be left blank for the institutional filter)
  • Search Tag: The search tag, which is the key you want to use for a search of a group of web locations
  • Search URLs: Search URLs, which are the web locations you want searched

An example of a completed filter is shown here:

uis news filter

Once the filter has been completed and saved, you will see a page that gives you worked examples of how to use it. For the filter shown above, this page looks as follows:

search forms uis news

The suggested code can be copied and pasted into your page. To change the text on the search button, alter the text in value="" that comes after 'input type="submit"' (shown in the above example as 'Search UIS news'. There are some additional attributes that should be added for accessibility purposes - the 'label' attribute ties the label to the appropriate input, and the accesskey value allows people using the University templates and a speaking browser easy access to search. With these additions, the above example looks like this:

<form method="get" action="http://search.cam.ac.uk/web"> <label for="query">Enter your search</label>
    <p>
        Enter your search: <input type="text" name="query" />
        then select <input type="submit" value="Search UIS news" id="query" accesskey="4" />
        <input type="hidden" name="inst" value="UIS" />
        <input type="hidden" name="tag" value="news" />
    </p>
</form>

When this search is used the results come back with the following heading:

search within filtered search

Using filtered searches in Falcon

If you want to use a filtered search in Falcon, first you need to complete the steps outlined above to create a filtered search for your institution, then you go to Site Setup > Site Configuration  - scroll down the page until you see 'Use University search engine', check the box by this heading, then add the values for Search InstID and Search Tag to the boxes below it, and save.

Dynamic search filters

There are some cases where it is impractical to manually create a search filter in our system for every filtered search you want to do.  Examples include: limiting the search to specific issues of the reporter, or to the pages of individual users. We have developed an alternative mechanism for these situations.

To perform a dynamic filtered search, use the following parameters in your URL:

filterTitle - A short title describing what is being searched (displayed on the results page)
include - A URL to include  (may be repeated)
exclude - A URL to exclude (may be repeated)

filterTitle is required, and at least one include or exclude is required.  A search result will only be displayed if it matches one or more include URLs, and does not match any exclude URL.

An example would be:

<form method="get" action="http://search.cam.ac.uk/web"><p>
Enter your search: <input type="text" name="query" />
then select <input type="submit" value="Search 2008-9 Special Reporter" />
<input type="hidden" name="filterTitle" value="Reporter special issues 2008-09" />
<input type="hidden" name="include" value="http://www.admin.cam.ac.uk/reporter/2008-09/special" />
</p></form>

You can try that here:

Enter your search:then select

Notes about html encoding

When characters that have special meaning in HTML (in particular, "<", "&", and ">") are needed as normal text they must be encoded as HTML named or numeric character entities. This might arise in the value given in <input name="filterTitle" type="hidden" value="Staff & students" />, as that piece of text is used as the heading on the search results page.

Comments and questions about the topics covered in these documents can be sent to

Last updated: August 2015

Search support

Please contact if you require further help.