The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ROADS::Index - A class to support searching of ROADS database indexes

SYNOPSIS

  use ROADS::Index;
  %results = index_search($restrictfile, $expansionfile, $stopfile,
                          $iquery, $caseful, $stemming);
  initExpansions($expansionfile);
  initIndexCache($targetindex);
  initRestrictions($restrictionfile);
  initStoplist($stopfile);
  
  # private
  if ($op = boolop) { ... }
  %results = expr;
  lookup;
  term;

DESCRIPTION

This class defines a series of methods for working with the ROADS database index. The main method which is called by outside code is index_search. This calls the other methods in turn to initialise the working environment, then carry out the search and process the results.

METHODS

%results = index_search($restrictfile, $expansionfile, $stopfile, $iquery, $caseful, $stemming);

This method takes the query iquery, together with a list of search options, and results the search results as a list of record handles for later processing with other tools. The search options are :-

restrictfile

This parameter specifies a file listing the templates and template attributes which should be made visible to end users.

expansionfile

This parameter specifies a file listing simple query expansions which should be carried out e.g. "color" as a synonym of "colour".

stopfile

This parameter specifies a file listing the terms which it should not be possible to search for, such as "a", "the" and so on.

caseful

This Boolean variable controls whether the search terms will be matched in a case sensitive or case insensitive way.

stemming

This Boolean variable controls whether stemming will be active for this search. When stemming is turned on, query expansion will be performed on the search terms to increase the number of matches.

initExpansions( expansionfile );

This method initialises the list of expansions which will be used during query expansion.

initIndexCache( targetindex );

This method opens the DB(M) based indirection index used to speed up searching of ROADS databases. This is nomally created by mkinv.pl when a database is indexed.

initRestrictions( restrictionfile );

This method intialises the search restrictions will be in force.

initStoplist( stopfile );

This method initialises the stoplist which will be in force.

boolop;

This method examines the string variable iquery in the main namespace, and searches for the presence of a Boolean AND or OR operator. If one of these is found it will be returned as the result of the method, otherwise a zero (0) will be returned.

%results = expr;

This method also operates on iquery, splitting it recurisvely into left and right sub-expressions and intervening operators, until there are no more sub-expressions left, and passing each sub-exprssion on to the term method.

%match = lookup( term );

This method tries to find ROADS database entries which match the search term, and returns the resulting handles.

term;

This method examines a search term, and potentially calls expr or lookup to further process it.

FILES

config/admin-restrict - default search restrictions for admin users.

config/expansions - default query expansions

config/search-restrict - default search restrictions for end users.

config/stoplist - terms which have been stop-listed and should be excluded from searches.

guts/index* - the actual ROADS database index.

guts/alltemps - list of template handles to filenam mappings.

BUGS

Some of this code is very messy, there is a fair bit of duplication of effort, and too much reliance on global variables - often making it hard to tell what's actually going on!

SEE ALSO

"wppd.pl" in bin

COPYRIGHT

Copyright (c) 1988, Martin Hamilton <martinh@gnu.org> and Jon Knight <jon@net.lut.ac.uk>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

It was developed by the Department of Computer Studies at Loughborough University of Technology, as part of the ROADS project. ROADS is funded under the UK Electronic Libraries Programme (eLib), the European Commission Telematics for Research Programme, and the TERENA development programme.

AUTHOR

Jon Knight <jon@net.lut.ac.uk>, Martin Hamilton <martinh@gnu.org>