+
+# append year limits if they exist
+my $limit_yr;
+my $limit_yr_value;
+if ($params->{'limit-yr'}) {
+ if ($params->{'limit-yr'} =~ /\d{4}-\d{4}/) {
+ my ($yr1,$yr2) = split(/-/, $params->{'limit-yr'});
+ $limit_yr = "yr,st-numeric,ge=$yr1 and yr,st-numeric,le=$yr2";
+ $limit_yr_value = "$yr1-$yr2";
+ }
+ elsif ($params->{'limit-yr'} =~ /\d{4}/) {
+ $limit_yr = "yr,st-numeric=$params->{'limit-yr'}";
+ $limit_yr_value = $params->{'limit-yr'};
+ }
+ push @limits,$limit_yr;
+ #FIXME: Should return a error to the user, incorect date format specified
+}
+
+# convert indexes and operands to corresponding parameter names for the z3950 search
+# $ %z3950p will be a hash ref if the indexes are present (advacned search), otherwise undef
+my $z3950par;
+my $indexes2z3950 = {
+ kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
+ 'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject',
+ ti=>'title', 'ti,phr'=>'title', se=>'title'
+};
+for (my $ii = 0; $ii < @operands; ++$ii)
+{
+ my $name = $indexes2z3950->{$indexes[$ii]};
+ if (defined $name && defined $operands[$ii])
+ {
+ $z3950par ||= {};
+ $z3950par->{$name} = $operands[$ii] if !exists $z3950par->{$name};
+ }
+}
+