Lines 101-108
returns ref to array result and count of results returned
Link Here
|
101 |
|
101 |
|
102 |
sub SearchAuthorities { |
102 |
sub SearchAuthorities { |
103 |
my ($tags, $and_or, $excluding, $operator, $value, $offset,$length,$authtypecode,$sortby) = @_; |
103 |
my ($tags, $and_or, $excluding, $operator, $value, $offset,$length,$authtypecode,$sortby) = @_; |
104 |
#use Data::Dumper; map {warn "CALL : ".Data::Dumper::Dumper($_);} @_; |
104 |
# warn "CALL : $tags, $and_or, $excluding, $operator, $value, $offset,$length,$authtypecode,$sortby"; |
105 |
my $dbh=C4::Context->dbh; |
105 |
my $dbh=C4::Context->dbh; |
|
|
106 |
use YAML; |
107 |
warn "tags : ",Dump($tags),"\noperators:",Dump($operator),"\nvalues:",Dump($value); |
106 |
if (C4::Context->preference('NoZebra')) { |
108 |
if (C4::Context->preference('NoZebra')) { |
107 |
|
109 |
|
108 |
# |
110 |
# |
Lines 213-226
sub SearchAuthorities {
Link Here
|
213 |
while ($n>1){$query= "\@or ".$query;$n--;} |
215 |
while ($n>1){$query= "\@or ".$query;$n--;} |
214 |
} |
216 |
} |
215 |
|
217 |
|
|
|
218 |
my $dosearch; |
216 |
my $and=" \@and " ; |
219 |
my $and=" \@and " ; |
217 |
my $q2=""; |
220 |
my $q2; |
218 |
for(my $i = 0 ; $i <= $#{$value} ; $i++) |
221 |
for(my $i = 0 ; $i <= $#{$value} ; $i++) |
219 |
{ |
222 |
{ |
220 |
if (@$value[$i]){ |
223 |
if (@$value[$i]){ |
221 |
##If mainentry search $a tag |
224 |
##If mainentry search $a tag |
222 |
if (@$tags[$i] eq "mainmainentry") { |
225 |
if (@$tags[$i] eq "mainmainentry") { |
223 |
$attr =" \@attr 1=Heading-Main "; |
226 |
|
|
|
227 |
# FIXME: 'Heading-Main' index not yet defined in zebra |
228 |
$attr =" \@attr 1=Heading-Main "; |
229 |
# $attr =" \@attr 1=Heading "; |
230 |
|
224 |
}elsif (@$tags[$i] eq "mainentry") { |
231 |
}elsif (@$tags[$i] eq "mainentry") { |
225 |
$attr =" \@attr 1=Heading "; |
232 |
$attr =" \@attr 1=Heading "; |
226 |
}else{ |
233 |
}else{ |
Lines 236-251
sub SearchAuthorities {
Link Here
|
236 |
$attr .=" \@attr 5=1 \@attr 4=6 ";## Word list, right truncated, anywhere |
243 |
$attr .=" \@attr 5=1 \@attr 4=6 ";## Word list, right truncated, anywhere |
237 |
} |
244 |
} |
238 |
$attr =$attr."\"".@$value[$i]."\""; |
245 |
$attr =$attr."\"".@$value[$i]."\""; |
239 |
$q2 =($q2 ne "" ?$and.$q2.$attr:$attr); |
246 |
$q2 =($q2?"$and $q2 $attr":"$attr"); |
|
|
247 |
$dosearch=1; |
240 |
}#if value |
248 |
}#if value |
241 |
} |
249 |
} |
242 |
##Add how many queries generated |
250 |
##Add how many queries generated |
243 |
if ($query=~/\S+/ && $q2 ne ""){ |
251 |
if ($query=~/\S+/){ |
244 |
$query= $and.$query.$q2; |
252 |
$query= $and.$query.$q2 |
245 |
} |
253 |
} else { |
246 |
elsif ($q2 ne "") { |
254 |
$query=$q2; |
247 |
$query=$q2; |
255 |
} |
248 |
} |
|
|
249 |
## Adding order |
256 |
## Adding order |
250 |
#$query=' @or @attr 7=2 @attr 1=Heading 0 @or @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc"); |
257 |
#$query=' @or @attr 7=2 @attr 1=Heading 0 @or @attr 7=1 @attr 1=Heading 1'.$query if ($sortby eq "HeadingDsc"); |
251 |
my $orderstring= ($sortby eq "HeadingAsc"? |
258 |
my $orderstring= ($sortby eq "HeadingAsc"? |
Lines 255-262
sub SearchAuthorities {
Link Here
|
255 |
'@attr 7=2 @attr 1=Heading 0' |
262 |
'@attr 7=2 @attr 1=Heading 0' |
256 |
:'' |
263 |
:'' |
257 |
); |
264 |
); |
258 |
my $allrecords=" \@attr 1=_ALLRECORDS \@attr 2=103 '' "; |
265 |
$query=($query?"\@or $orderstring $query":"\@or \@attr 1=_ALLRECORDS \@attr 2=103 '' $orderstring "); |
259 |
$query=($q2?"\@or $orderstring $query":"\@or $orderstring ".($query?"\@and $allrecords $query":$allrecords) ); |
|
|
260 |
|
266 |
|
261 |
$offset=0 unless $offset; |
267 |
$offset=0 unless $offset; |
262 |
my $counter = $offset; |
268 |
my $counter = $offset; |