Ignore:
Timestamp:
2012-08-09T17:20:51+12:00 (12 years ago)
Author:
ak19
Message:

Finally properly fixed the appearance and non-appearance of the quick search form. It should not appear if there are no query elements in the config file. However, even when no search indexes were built, query elements still came through in the XML and it was hard to distinguish at the XSLT stage whether any search indexes were built or not. Kathy suggested that the perl code writing out the buildconfig.xml should not write out the ServiceRacks for searching if no indexes were built and pointed out that the changes were required in buildconfigxml.pm which was called from basebuilder.pm to write out the buildConfig.xml file. Now the XSLT can at last do the right thing: it doesn't display the quick search area if there are no search elements, and doesn't provide the plain text query form in the quick search area if TextQuery isn't one of the query types, but does provide the buttons to other query types like form search if these are meant to be visible according to the SearchType format feature. If there are no search indexes built, then there is no quick search area.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildConfigxml.pm

    r25758 r26094  
    273273    }
    274274    } else {
    275     print STDERR "$maptype not defined";
    276     }
    277 
     275    print STDERR "$maptype not defined\n";
     276    }
     277
     278    $settings->{'num_indexes'} = $buildcfg->{'num_indexes'};
    278279    $settings->{'defaultindex'} = $defaultindex;
    279280    $settings->{'indexmap'} = $indexmap;
     
    352353    }
    353354    # the default level assigned by the user is no longer ignored [Shaoqun], but the retrievel level stays the same.
    354         #if (defined $collectcfg->{"defaultlevel"}) {
    355     $default_search_level = $levelmap->{$collectcfg->{"defaultlevel"}};
     355    if (defined $collectcfg->{"defaultlevel"}) {
     356        $default_search_level = $levelmap->{$collectcfg->{"defaultlevel"}};
    356357        #  $default_retrieve_level = $default_search_level;
    357     #}
     358    }
    358359   
    359360    if (defined $buildcfg->{'textlevel'}) {
     
    366367    $settings->{'levelmap'} = $levelmap;
    367368    $settings->{'levellist'} = $levellist;
    368     $settings->{'default_search_level'} = $default_search_level;
     369    $settings->{'default_search_level'} = $default_search_level if $default_search_level;
    369370    $settings->{'default_retrieve_level'} = $default_retrieve_level;
    370371    $settings->{'default_db_level'} = $default_db_level;
     
    383384    my $service_type = $settings->{'service_type'};
    384385
     386    # there's no searching and therefore no search services if there are no indexes
     387    return if($settings->{'num_indexes'} <= 0);
     388   
    385389    # do the search service
    386390    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]);
     
    523527    my ($buildcfg,$settings) = @_;
    524528
     529    #return if($settings->{'num_indexes'} <= 0);    # no search if no indexes
     530   
    525531    my $infodbtype   = $settings->{'infodbtype'};
    526532
Note: See TracChangeset for help on using the changeset viewer.