View | Details | Raw Unified | Return to bug 12861
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-33 / +38 lines)
Lines 140-172 sub SearchAuthorities { Link Here
140
    my $and=" \@and " ;
140
    my $and=" \@and " ;
141
    my $q2;
141
    my $q2;
142
    my $attr_cnt = 0;
142
    my $attr_cnt = 0;
143
    for(my $i = 0 ; $i <= $#{$value} ; $i++)
143
    for ( my $i = 0 ; $i <= $#{$value} ; $i++ ) {
144
    {
144
        if ( @$value[$i] ) {
145
        if (@$value[$i]){
145
            if ( @$tags[$i] ) {
146
            if ( @$tags[$i] eq "mainmainentry" ) {
146
                if ( @$tags[$i] eq "mainmainentry" ) {
147
                $attr = " \@attr 1=Heading-Main ";
147
                    $attr = " \@attr 1=Heading-Main ";
148
            }
148
                }
149
            elsif ( @$tags[$i] eq "mainentry" ) {
149
                elsif ( @$tags[$i] eq "mainentry" ) {
150
                $attr = " \@attr 1=Heading ";
150
                    $attr = " \@attr 1=Heading ";
151
            }
151
                }
152
            elsif ( @$tags[$i] eq "match" ) {
152
                elsif ( @$tags[$i] eq "match" ) {
153
                $attr = " \@attr 1=Match ";
153
                    $attr = " \@attr 1=Match ";
154
            }
154
                }
155
            elsif ( @$tags[$i] eq "match-heading" ) {
155
                elsif ( @$tags[$i] eq "match-heading" ) {
156
                $attr = " \@attr 1=Match-heading ";
156
                    $attr = " \@attr 1=Match-heading ";
157
            }
157
                }
158
            elsif ( @$tags[$i] eq "see-from" ) {
158
                elsif ( @$tags[$i] eq "see-from" ) {
159
                $attr = " \@attr 1=Match-heading-see-from ";
159
                    $attr = " \@attr 1=Match-heading-see-from ";
160
            }
160
                }
161
            elsif ( @$tags[$i] eq "thesaurus" ) {
161
                elsif ( @$tags[$i] eq "thesaurus" ) {
162
                $attr = " \@attr 1=Subject-heading-thesaurus ";
162
                    $attr = " \@attr 1=Subject-heading-thesaurus ";
163
            }
163
                }
164
            else { # Assume any if no index was specified
164
                else {    # Assume any if no index was specified
165
                    $attr = " \@attr 1=Any ";
166
                }
167
            }         #if @$tags[$i]
168
            else {    # Assume any if no index was specified
165
                $attr = " \@attr 1=Any ";
169
                $attr = " \@attr 1=Any ";
166
            }
170
            }
171
167
            if ( @$operator[$i] eq 'is' ) {
172
            if ( @$operator[$i] eq 'is' ) {
168
                $attr .= " \@attr 4=1  \@attr 5=100 "
173
                $attr .= " \@attr 4=1  \@attr 5=100 "
169
                  ; ##Phrase, No truncation,all of subfield field must match
174
                  ;    ##Phrase, No truncation,all of subfield field must match
170
            }
175
            }
171
            elsif ( @$operator[$i] eq "=" ) {
176
            elsif ( @$operator[$i] eq "=" ) {
172
                $attr .= " \@attr 4=107 ";    #Number Exact match
177
                $attr .= " \@attr 4=107 ";    #Number Exact match
Lines 177-200 sub SearchAuthorities { Link Here
177
            }
182
            }
178
            elsif ( @$operator[$i] eq "exact" ) {
183
            elsif ( @$operator[$i] eq "exact" ) {
179
                $attr .= " \@attr 4=1  \@attr 5=100 \@attr 6=3 "
184
                $attr .= " \@attr 4=1  \@attr 5=100 \@attr 6=3 "
180
                  ; ##Phrase, No truncation,all of subfield field must match
185
                  ;    ##Phrase, No truncation,all of subfield field must match
181
            }
186
            }
182
            else {
187
            else {
183
                $attr .= " \@attr 5=1 \@attr 4=6 "
188
                $attr .= " \@attr 5=1 \@attr 4=6 "
184
                  ;    ## Word list, right truncated, anywhere
189
                  ;    ## Word list, right truncated, anywhere
185
                  if ($sortby eq 'Relevance') {
190
                if ( $sortby eq 'Relevance' ) {
186
                      $attr .= "\@attr 2=102 ";
191
                    $attr .= "\@attr 2=102 ";
187
                  }
192
                }
188
            }
193
            }
189
            @$value[$i] =~ s/"/\\"/g; # Escape the double-quotes in the search value
194
            @$value[$i] =~
190
            $attr =$attr."\"".@$value[$i]."\"";
195
              s/"/\\"/g;    # Escape the double-quotes in the search value
191
            $q2 .=$attr;
196
            $attr = $attr . "\"" . @$value[$i] . "\"";
192
            $dosearch=1;
197
            $q2 .= $attr;
198
            $dosearch = 1;
193
            ++$attr_cnt;
199
            ++$attr_cnt;
194
            if ($QParser) {
200
            if ($QParser) {
195
                $qpquery .= " $tags->[$i]:\"$value->[$i]\"";
201
                $qpquery .= " $tags->[$i]:\"$value->[$i]\"";
196
            }
202
            }
197
        }#if value
203
        }    #if value
198
    }
204
    }
199
    ##Add how many queries generated
205
    ##Add how many queries generated
200
    if (defined $query && $query=~/\S+/){
206
    if (defined $query && $query=~/\S+/){
201
- 

Return to bug 12861