Changeset 4768
- Timestamp:
- 2003-06-23T14:49:14+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/mgppbuilder.pm
r3805 r4768 63 63 64 64 # change this so a user can add their own ones in via a file or cfg 65 #add AND, OR, NOT NEAR to this list - these cannot be used as field names 65 66 %static_indexfield_map = ('Title'=>'TI', 66 67 'TI'=>1, … … 69 70 'Creator'=>'CR', 70 71 'CR'=>1, 71 'Organization'=>'OR ',72 'OR '=>1,72 'Organization'=>'ORG', 73 'ORG'=>1, 73 74 'Source'=>'SO', 74 75 'SO'=>1, … … 81 82 'People'=>'PE', 82 83 'PE'=>1, 84 'AllFields'=>'ZZ', 85 'ZZ'=>1, 83 86 'TextOnly'=>'TX', 84 'TX'=>1); 87 'TX'=>1, 88 'AND'=>1, 89 'OR'=>1, 90 'NOT'=>1, 91 'NEAR'=>1); 85 92 86 93 sub new { … … 115 122 $self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname); 116 123 124 # sort out the indexes 125 #indexes are specified with spaces, but we put them into one index 126 my $indexes = $self->{'collect_cfg'}->{'indexes'}; 127 $self->{'collect_cfg'}->{'indexes'} = []; 128 push (@{$self->{'collect_cfg'}->{'indexes'}}, join(',', @$indexes)); 129 130 117 131 # sort out subcollection indexes 118 132 if (defined $self->{'collect_cfg'}->{'indexsubcollections'}) { … … 402 416 403 417 # the directory name starts with a processed version of index fields 404 my ($pindex) = $self->process_field($fields); 405 # next comes a processed version of the index 406 $pindex = lc ($pindex); 407 418 #my ($pindex) = $self->process_field($fields); 419 #$pindex = lc ($pindex); 420 # now we only ever have one index, and its called 'idx' 421 $pindex = 'idx'; 422 408 423 # next comes a processed version of the subcollection if there is one. 409 424 my $psub = $self->process_field ($subcollection); … … 900 915 # store the indexfieldmap information 901 916 my @indexfieldmap = (); 902 #add all fields bit - sort based on keys. text only is put at front 903 if (defined $self->{'buildproc'}->{'indexfields'}->{'TextOnly'}) { 904 push (@indexfieldmap, "TextOnly\-\>TX"); 905 } 906 foreach $field (sort keys %{$self->{'buildproc'}->{'indexfields'}}) { 907 next if $field eq "TextOnly"; 908 push (@indexfieldmap, "$field\-\>$self->{'buildproc'}->{'indexfieldmap'}->{$field}"); 917 my @indexfields = (); 918 my $specifiedfields = {}; 919 my @specifiedfieldorder = (); 920 # go through the index definition and add each thing to a map, so we can easily check if it is already specified - when doing the metadata, we print out all the individual fields, but some may already be specified in the index definition, so we dont want to add those again. 921 foreach $field (@{$self->{'collect_cfg'}->{'indexes'}}) { 922 my @fs = split(',', $field); 923 foreach $f(@fs) { 924 $specifiedfields->{$f}=1; 925 push (@specifiedfieldorder, "$f"); 926 } 927 } 928 929 #add all fields bit 930 foreach $field (@specifiedfieldorder) { 931 if ($field eq "metadata") { 932 foreach $newfield (keys %{$self->{'buildproc'}->{'indexfields'}}) { 933 if (!defined $specifiedfields->{$newfield}) { 934 push (@indexfieldmap, "$newfield\-\>$self->{'buildproc'}->{'indexfieldmap'}->{$newfield}"); 935 push (@indexfields, "$newfield"); 936 } 937 } 938 939 } elsif ($field eq 'text') { 940 push (@indexfieldmap, "TextOnly\-\>TX"); 941 push (@indexfields, "TextOnly"); 942 } elsif ($field eq 'allfields') { 943 push (@indexfieldmap, "AllFields\-\>ZZ"); 944 push (@indexfields, "AllFields"); 945 } else { 946 push (@indexfieldmap, "$field\-\>$self->{'buildproc'}->{'indexfieldmap'}->{$field}"); 947 push (@indexfields, "$field"); 948 949 } 950 #if (defined $self->{'buildproc'}->{'indexfields'}->{'TextOnly'}) { 951 #push (@indexfieldmap, "TextOnly\-\>TX"); 952 #} 953 #foreach $field (sort keys %{$self->{'buildproc'}->{'indexfields'}}) { 954 #next if $field eq "TextOnly"; 955 #push (@indexfieldmap, "$field\-\>$self->{'buildproc'}->{'indexfieldmap'}->{$field}"); 909 956 } 910 957 911 958 $build_cfg->{'indexfieldmap'} = \@indexfieldmap; 959 $build_cfg->{'indexfields'} = \@indexfields; 912 960 913 961 #store the indexed field information 914 foreach $field (sort keys %{$self->{'buildproc'}->{'indexfields'}}) {962 #foreach $field (sort keys %{$self->{'buildproc'}->{'indexfields'}}) { 915 963 916 push (@{$build_cfg->{'indexfields'}}, $field);917 }964 #push (@{$build_cfg->{'indexfields'}}, $field); 965 #} 918 966 # write out the build information 919 967 &cfgread::write_cfg_file("$self->{'build_dir'}/build.cfg", $build_cfg,
Note:
See TracChangeset
for help on using the changeset viewer.