DESIRE: Development of a European Service for Information on Research and Education


Offering a choice of ranking algorithms in ROADS


The standard module was replaced by one that uses autoloading to load an algorithm selected on the search page and read from the CGIVar variable.


Algorithms should be placed in: lib/auto/ROADS/Rank/ so that they will be picked up by the autoloader. To get the default ROADS ranking algorithm place in the above directory - it will be used by default if no other algorithm is selected.

The autoloader checks the rankingalg CGI variable to see which algorithm to use. Additional information can also be passed to the ranking algorithm. In this case the rankingalg CGI variable should contain be of the form: rankingalg:info. The part before the colon will be used to invoke the ranking algorithm and the part after the colon is passed as an argument to the ranking algorithm.

A simple alphabetic ranking algorithm is also available: This ranking algorithm requires the name of the attribute by which the results should be sorted. For example, to sort alphabetically by title rankingalg should be set to: alpha:title

The query is also passed in all cases (it is required by the default algorithm and may be useful to others).

The rankingalg variable should be set on the search pages (generated by and A selection box can be used to allow the user to select between ranking algorithms for a particular query. It may also make sense to turn ranking on rather than allowing the user to toggle it.

HTML code similar to the following should be added to config/multilingual/[Language]/[search/|admin/]:

<INPUT TYPE="hidden" NAME="ranking" VALUE="on">
  <SELECT NAME="rankingalg">
   <OPTION VALUE="default" SELECTED>Default
   <OPTION VALUE="quality:imgsize">Largest Image Size First
   <OPTION VALUE="quality:imgsizerev">Smallest Image Size First

Adding a new algorithm

New algorithms should be placed in lib/auto/ROADS/Rank/ and have the extension .al. The name of the file should be the same as the name of the ranking routine it contains, this name will be used to autoload the routine.

Use the provided as an example. If the algorithm require additional information to be passed in, as described above, this will be passed as the second argument to the routine, the first still being the current query.

The search forms should then be updated to offer the new algorithm as a choice.

Maintained by: Tracy Gardner of UKOLN, the UK Office for Library and Information Networking, University of Bath.
Document created: 20-Apr-1999.
Last updated: 20-Apr-1999.

[Quality Ratings] [Metadata] [UKOLN]