Changeset 426 for trunk/gsdl/perllib/classify/List.pm
- Timestamp:
- 1999-08-02T17:17:27+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/List.pm
r385 r426 1 1 # simple list classifier plugin 2 # collect.cfg usage: 'List metaelement' or simply 'List'3 # the first will create a single list of all documents4 # with metaelement metadata (sorted alphabetically by whichever5 # metadata element was chosen).6 # The second will create a single list of all documents7 # which won't be sorted at all - they may well be in8 # some completely random order ;-|9 2 # options are: 3 # metadata=Metaname -- (optional) all documents with Metaname metadata 4 # will be included in list, list will be sorted 5 # by this element. if not included all documents 6 # will be included in list in build (random) order 7 # title=Title -- (optional) the title field for this classification. 8 # if not included title field will be Metaname. 9 # if metadata is also not included title will be 'List' 10 10 11 11 package List; … … 17 17 18 18 my $list = []; 19 if (defined $options[0]) { 20 $list = {}; 19 my ($metaname, $title); 20 21 foreach $option (@options) { 22 if ($option =~ /^metadata=(.*)$/i) { 23 $metaname = $1; 24 $list = {}; 25 } elsif ($option =~ /^title=(.*)$/i) { 26 $title = $1; 27 } 28 } 29 30 if (!defined $title) { 31 if (defined $metaname) { 32 $title = $metaname; 33 } else { 34 $title = 'List'; 35 } 21 36 } 22 37 23 38 return bless { 24 39 'list'=>$list, 25 'metaname' => $options[0] 40 'metaname' => $metaname, 41 'title' => $title 26 42 }, $class; 27 43 } … … 53 69 } 54 70 if (defined $self->{'list'}->{$doc_OID}) { 71 print STDERR "metavalue: $metavalue\n"; 72 print STDERR "title: $self->{'title'}\n"; 55 73 print STDERR "WARNING: List::classify called multiple times for $doc_OID\n"; 56 74 } … … 65 83 my $self = shift (@_); 66 84 67 my $classifytitle = "List";68 85 my $contains = ""; 69 86 my @list = (); 70 87 if (defined $self->{'metaname'}) { 71 $classifytitle = $self->{'metaname'};72 88 if (keys %{$self->{'list'}}) { 73 89 @list = sort {$self->{'list'}->{$a} … … 80 96 # organise into classification structure 81 97 my %classifyinfo = ('classifytype'=>'List', 82 'Title'=>$ classifytitle,98 'Title'=>$self->{'title'}, 83 99 'contains'=>[]); 84 100 foreach $OID (@list) {
Note:
See TracChangeset
for help on using the changeset viewer.