Library Search

From refbase

The "library search," is a special one-click search, offered directly at the start page and in the footer of every page. The refbase admin can configure which subset of the database the "library search" uses.


Changing the library search

This chapter is solely relavant for the refbase admin

Definition of what this search is searching for

The 'library_search.php' script will search within a subset of your refbase database. Searches via this library search form will be restricted to the condition given in variable '$librarySearchPattern' in file 'initialize/'.

There you will find this explanation:

Define what will be searched by "library_search.php": refbase offers a "Library Search" feature that provides a separate search page for searching an institution's library. All searches performed thru this search form will be restricted to records that match the specified condition. First param must be a valid field name from table 'refs', second param the conditional expression (specified as MySQL extended regular expression -> see note at the end of this file). Of course, you could also use this feature to restrict searches thru "library_search.php" by _any_ other condition. E.g., with "location" as the first parameter and your own login email address as the second parameter, any "library" search would be restricted to your personal literature data set.

If, for example, items of your institute's library are also catalogued in your refbase database, then you could use the library search feature to only search items in your institute's library.

At the Institute for Polarecology Kiel, we add items of our local library to our refbase database using a dedicated refbase account (named "Library Admin" or the like). We've then set variable '$librarySearchPattern' in '' to:

$librarySearchPattern = array("location", "library"); // e.g. 'array("location", "IPĂ– Library")'

This will restrict searches via 'library_search.php' to records that contain the word "Library" within the 'location' field. Thus search results will only show items from our institute's library. The search results list will also display additional/different fields by default, such as the 'call_number' field (which contains the unique library identifier for the item).

You could, instead, search results to items that contain a particular author, publication, keyword, contribution_id, etc. As an example, consider that you've tagged a particular subset of your database records with the word "Students Reading List" in the 'keywords' field. Then you could use this setup:

$librarySearchPattern = array("keywords", "Students Reading List");

to restrict searches via 'library_search.php' to records that contain the keyword "Students Reading List".

Changing the name of "library search"

Since the name of the standard-link 'library search' is sometimes confusing (especially, if you define your own query), you can change this in one of two ways. Both involve modifying refbase files which will be overwritten on upgrades.

Customized localization

"Library" and "Search" are defined in the language-file 'locales/'. You can modify "Library" to make it more descriptive.

Alternative: customize index.php

  • Open 'index.php' of your refbase installation.

Search for this line:

<li><a href="library_search.php"><?php echo $loc["Library"]; ?> <?php echo $loc["Search"]; ?>

and replace this

?php echo $loc["Library"]; ?> <?php echo $loc["Search"]; ?

part of the line with your desired link name.

  • Open the 'includes/' file and search for 'library'

you have to change the 'title'-parameter and the link name.

For these changes, you may either use static names (which will remove the localization of refbase for your users) or define new localized variables.

Hiding the link

An alternative to customizing the search is to remove it completely. One can safely comment out or remove the lines in 'index.php' and 'includes/'.