This is an old revision of the document!

More about Classifiers (Greenstone 2)

I've added a new type of classification to my collection. How do I create and add the navigation bar images?

Visit this page and follow the instructions. Note: this is only necessary for Greenstone v2.62 and earlier (newer versions use CSS to generate the navigation bar automatically).

I've added a new type of classification to my collection. How do I translate the navigation bar labels (2.71 and later)?

By default, the Title of a classifier is used as the button label in the navigation bar. The Title given to a classifier depends on the options used when creating it. In general, the -buttonname option will be used first, or the -metadata option if no buttonname is specified. The library looks for alternative text or translations in the macro files. If the Title is XXX, if the macro _labelXXX_ is defined, then this will be used for the label. If it is not defined, then the Title will be used as is. _textXXX_ and _textdescrXXX_ are used for the roll over text and help text on the about page. Provide translations of these macros to get translations of the label and help text.

How can I do Unicode collation for my classifier?

GenericList is the only classifier that supports non [a-z0-9] metadata values. It will handle creating horizontal lists using different scripts. Support for Unicode collection has been added to GenericList since 2.73. To set this up, you need to do the following:

  • Make sure you're using Greenstone 2.73 or later.
  • Download the file and put this in your system Perl "lib/Unicode/Collate" directory (Unix) or in the Greenstone "bin/windows/perl/lib/Unicode/Collate" folder (Windows).
  • Specify the "-sort_using_unicode_collation" option for your GenericList.
  • Rebuild the collection.

How do I use dynamic classifiers?

Only available for Greenstone version 2.81 and later. This feature is not available from GLI yet, you'll need to edit the collect.cfg file by hand.

  • Edit the collection's collect.cfg file (make sure its not open in GLI first) and add the line

infodbtype sqlite

  • Rebuild the collection to create an sqlite database instead of the gdbm database. This can be done from GLI. Then close the collection in GLI.

Dynamic classifiers are created at runtime, so no more rebuilding is required for classifier modifications.

To add a classifier, edit the collect.cfg file and add a line like dynamic_classifier Subjects "dc.Subject"

The first option, Subjects is the name of the classifier: this is the identifier for format statements, and the name that appears in the navigation bar. This is not translatable yet. The second option "dc.Subject" is the options for the classifier. The first part specifies the metadata that it should be built on.

Further options to the classifier include

  • -split_using_hierarchy_separator X
  • -group_by_first_character
  • -use_hlist_at_top
  • -split_greenstone_dates
  • -sort_documents_by Y

These need to be added to the classifier specification inside the quotes, for example

dynamic_classifier Subjects "dc.Subject -split_using_hierarchy_specifier | -use_hlist_at_top"

After each change you can go directly to the classifier web page and refresh to see your changes.

Formatting the dynamic classifier

Formatting is done in the same way as for standard classifiers, with format statements. The format statements are specified based on the classifier name, for example, SubjectsVList and SubjectsHList (instead of CL1VList etc).

In addition, dynamic classifiers can optionally use a few new format statements:

  • SubjectsDocumentNodes: if this is specified, the SubjectsVlist and SubjectsHList are only used for classifier nodes, and SubjectsDocumentNodes will be used for document nodes. This avoids the need for {If}{[numleafdocs],} tests everywhere.
  • SubjectsHeader: will be displayed above the classifier
  • SubjectsFooter: will be displayed below the classifier