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

(-)a/C4/AuthoritiesMarc.pm (-5 / +4 lines)
Lines 206-223 sub SearchAuthorities { Link Here
206
        }    #if value
206
        }    #if value
207
    }
207
    }
208
    ##Add how many queries generated
208
    ##Add how many queries generated
209
    if (defined $query && $query=~/\S+/){
209
    if ( defined $query && $query =~ /\S+/ ) {
210
        #NOTE: This code path is used by authority search in cataloguing plugins...
210
        #NOTE: This code path is used by authority search in cataloguing plugins...
211
        #FIXME: This does not quite work the way the author probably intended.
211
        #FIXME: This does not quite work the way the author probably intended.
212
        #It creates a ($query prefix) AND (query 1) AND (query 2) structure instead of
212
        #It creates a ($query prefix) AND (query 1) AND (query 2) structure instead of
213
        #($query prefix) AND (query 1 AND query 2)
213
        #($query prefix) AND (query 1 AND query 2)
214
      $query= $and x $attr_cnt . $query . (defined $q2 ? $q2 : '');
214
        $query = $and x $attr_cnt . $query . ( defined $q2 ? $q2 : '' );
215
    } else {
215
    } else {
216
        #NOTE: This code path is used by authority search in authority home and record matching rules...
216
        #NOTE: This code path is used by authority search in authority home and record matching rules...
217
        my $op_prefix = '';
217
        my $op_prefix = '';
218
        #NOTE: Without the following code, multiple queries will never be joined together
218
        #NOTE: Without the following code, multiple queries will never be joined together
219
        #with a Boolean operator.
219
        #with a Boolean operator.
220
        if ($attr_cnt > 1){
220
        if ( $attr_cnt > 1 ) {
221
            #NOTE: We always need 1 less operator than we have operands,
221
            #NOTE: We always need 1 less operator than we have operands,
222
            #so long as there is more than 1 operand
222
            #so long as there is more than 1 operand
223
            my $or_cnt = $attr_cnt - 1;
223
            my $or_cnt = $attr_cnt - 1;
Lines 225-231 sub SearchAuthorities { Link Here
225
            $op_prefix = ' @or ' x $or_cnt;
225
            $op_prefix = ' @or ' x $or_cnt;
226
            #NOTE: This evaluates to a logical structure like (query 1) OR (query 2) OR (query 3)
226
            #NOTE: This evaluates to a logical structure like (query 1) OR (query 2) OR (query 3)
227
        }
227
        }
228
      $query= $op_prefix . $q2;
228
        $query = $op_prefix . $q2;
229
    }
229
    }
230
    ## Adding order
230
    ## Adding order
231
    #$query=' @or  @attr 7=2 @attr 1=Heading 0 @or  @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc");
231
    #$query=' @or  @attr 7=2 @attr 1=Heading 0 @or  @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc");
232
- 

Return to bug 20596