CollectionIndexer.pm

Contents


1. Description
2. Usage
3. Method Index

1. Description

The perl module CollectionIndexer.pm provides an API for (re)creating the various indexes of a document collection.

2. Usage

The following examples show the basic usage of the CollectionIndexer module.

Creating a new document in a collection
use CollectionIndexer;   # CollectionIndexer has to be in @INC
  #
$collection = new CollectionIndexer;   # creating a new instance
$indexer -> setCollectionName('CERN/Test');   # setting the name of the collection
$indexer -> setDirectoryBase('/afs/cern.ch/project/support/ref');   # setting the directory base
$indexer -> setUrlBase('http://cern.ch/ref');   # setting the URL base
$indexer -> doIndexes();   # executes the index creation.


3. Method Index

  new()
  getCollectionName()
  setCollectionName()
  getDirectoryBase()
  setDirectoryBase()
  getUrlBase()
  setUrlBase()
  getRecreateOption()
  setRecreateOption()
  getDebugOption()
  setDebugOption()
  getVerboseOption()
  setVerboseOption()
  doIndexes()
  _doDocList()
  _readConfiguration()
  _replaceVariables()
  _updateHtaccessFile()
  

new

Creates a new instance of CollectionIndexer.

Example: $indexer = new CollectionIndexer;


setCollectionName

Specifies the collection name for which the indexes should be generated.

Example: $indexer->setCollectionName('CERN/IT/US');


getCollectionName

Returns the mame of the collection if previously defined with setCollectionName, otherwise throws an error.

Example: $collection_name = $indexer->getCollectionName();


setDirectoryBase

Sets the base directory for the set of collections.

Example: $indexer->setDirectoryBase('/full/path/to/base/directory');


getDirectoryBase

Returns the mame of the base directory if previously defined with setDirectoryBase, otherwise throws an error.

Example: $directroy_base = $indexer->getDirectoryBase();


setUrlBase

Defines the URL base for the absolute URLs which will be used in the various index files which are created by CollectionIndexer

Example: $indexer->setUrlBase('http://cern.ch/ref');


getUrlBase

Returns the URL base if previously defined with setUrlBase, otherwise throws an error.

Example: $url_base = $indexer->getUrlBase();


setRecreateOption

If this option is used the 'dummydocuments' will be recreated from the individual meta-data files of the individual documents.

Example: $indexer->setRecreateOption('1');


getRecreateOption

Returns 0 or 1 depending on the present setting of the 'RecreateOption'

Example: $present_recreate_option = $indexer->getRecreateOption();


setDebugOption

Sets the debugging option which will result in very detailed output when the indexes are created using the doIndexes method. Not too surprising from it's name this option is mainly for debugging purposes.

Example: $indexer->setDebugOption('1');


getDebugOption

Returns 0 or 1 depending on the present setting of the 'Debug' option.

Example: $present_debug_option = $indexer->getDebugOption();


setVerboseOption

Sets the verbose option, i.e. the main steps of the index creation will be returned as output when using the doIndexes method. Also this option is mainly for problem tracing.

Example: $indexer


getVerboseOption

Returns 0 or 1 depending on the present setting of the 'Verbose' option.

Example: $indexer


doIndexes

Starts the index creation.

Example: $indexer


Helium
Helium

_doDocList

Internal method used accordingly when the doIndexes method is executed.


_readConfiguration

Internal method used accordingly when the doIndexes method is executed.


_replaceVariables

Internal method used accordingly when the doIndexes method is executed.


_updateHtaccessFile

Internal method used accordingly when the doIndexes method is executed and the 'Recreate' option is set.

Example: $indexer