|
Lines 355-366
sub run_marc21_search_tests {
Link Here
|
| 355 |
my $results_hashref; |
355 |
my $results_hashref; |
| 356 |
my $facets_loop; |
356 |
my $facets_loop; |
| 357 |
( undef, $results_hashref, $facets_loop ) = |
357 |
( undef, $results_hashref, $facets_loop ) = |
| 358 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
358 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 359 |
is($results_hashref->{biblioserver}->{hits}, 101, "getRecords keyword search for 'book' matched right number of records"); |
359 |
is($results_hashref->{biblioserver}->{hits}, 101, "getRecords keyword search for 'book' matched right number of records"); |
| 360 |
is(scalar @{$results_hashref->{biblioserver}->{RECORDS}}, 19, "getRecords returned requested number of records"); |
360 |
is(scalar @{$results_hashref->{biblioserver}->{RECORDS}}, 19, "getRecords returned requested number of records"); |
| 361 |
my $record5 = $results_hashref->{biblioserver}->{RECORDS}->[5]; |
361 |
my $record5 = $results_hashref->{biblioserver}->{RECORDS}->[5]; |
| 362 |
( undef, $results_hashref, $facets_loop ) = |
362 |
( undef, $results_hashref, $facets_loop ) = |
| 363 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '20', 5, undef, \%branches, \%itemtypes, 'ccl', undef); |
363 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '20', 5, \%branches, \%itemtypes, 'ccl', undef); |
| 364 |
ok(!defined $results_hashref->{biblioserver}->{RECORDS}->[0] && |
364 |
ok(!defined $results_hashref->{biblioserver}->{RECORDS}->[0] && |
| 365 |
!defined $results_hashref->{biblioserver}->{RECORDS}->[1] && |
365 |
!defined $results_hashref->{biblioserver}->{RECORDS}->[1] && |
| 366 |
!defined $results_hashref->{biblioserver}->{RECORDS}->[2] && |
366 |
!defined $results_hashref->{biblioserver}->{RECORDS}->[2] && |
|
Lines 369-412
sub run_marc21_search_tests {
Link Here
|
| 369 |
$results_hashref->{biblioserver}->{RECORDS}->[5] eq $record5, "getRecords cursor works"); |
369 |
$results_hashref->{biblioserver}->{RECORDS}->[5] eq $record5, "getRecords cursor works"); |
| 370 |
|
370 |
|
| 371 |
( undef, $results_hashref, $facets_loop ) = |
371 |
( undef, $results_hashref, $facets_loop ) = |
| 372 |
getRecords('ti:book', 'ti:book', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
372 |
getRecords('ti:book', 'ti:book', [], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 373 |
is($results_hashref->{biblioserver}->{hits}, 11, "getRecords title search for 'book' matched right number of records"); |
373 |
is($results_hashref->{biblioserver}->{hits}, 11, "getRecords title search for 'book' matched right number of records"); |
| 374 |
|
374 |
|
| 375 |
( undef, $results_hashref, $facets_loop ) = |
375 |
( undef, $results_hashref, $facets_loop ) = |
| 376 |
getRecords('au:Lessig', 'au:Lessig', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
376 |
getRecords('au:Lessig', 'au:Lessig', [], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 377 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords title search for 'Australia' matched right number of records"); |
377 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords title search for 'Australia' matched right number of records"); |
| 378 |
|
378 |
|
| 379 |
if ( $indexing_mode eq 'dom' ) { |
379 |
if ( $indexing_mode eq 'dom' ) { |
| 380 |
( undef, $results_hashref, $facets_loop ) = |
380 |
( undef, $results_hashref, $facets_loop ) = |
| 381 |
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
381 |
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 382 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ && |
382 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Efectos del ambiente/ && |
| 383 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && |
383 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && |
| 384 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ |
384 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ |
| 385 |
, "Simple relevance sorting in getRecords matches old behavior"); |
385 |
, "Simple relevance sorting in getRecords matches old behavior"); |
| 386 |
|
386 |
|
| 387 |
( undef, $results_hashref, $facets_loop ) = |
387 |
( undef, $results_hashref, $facets_loop ) = |
| 388 |
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
388 |
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 389 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ && |
389 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ && |
| 390 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && |
390 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[6],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && |
| 391 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' |
391 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' |
| 392 |
, "Simple ascending author sorting in getRecords matches old behavior"); |
392 |
, "Simple ascending author sorting in getRecords matches old behavior"); |
| 393 |
|
393 |
|
| 394 |
( undef, $results_hashref, $facets_loop ) = |
394 |
( undef, $results_hashref, $facets_loop ) = |
| 395 |
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
395 |
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 396 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && |
396 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && |
| 397 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && |
397 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[12],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ && |
| 398 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ |
398 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/la enfermedad laboral\^ies$/ |
| 399 |
, "Simple descending author sorting in getRecords matches old behavior"); |
399 |
, "Simple descending author sorting in getRecords matches old behavior"); |
| 400 |
|
400 |
|
| 401 |
( undef, $results_hashref, $facets_loop ) = |
401 |
( undef, $results_hashref, $facets_loop ) = |
| 402 |
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
402 |
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 403 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' && |
403 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' && |
| 404 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && |
404 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && |
| 405 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ |
405 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() =~ m/^Indicadores de resultados identificados/ |
| 406 |
, "Simple ascending publication date sorting in getRecords matches old behavior"); |
406 |
, "Simple ascending publication date sorting in getRecords matches old behavior"); |
| 407 |
|
407 |
|
| 408 |
( undef, $results_hashref, $facets_loop ) = |
408 |
( undef, $results_hashref, $facets_loop ) = |
| 409 |
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
409 |
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 410 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ && |
410 |
ok(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper() =~ m/^Estado de salud/ && |
| 411 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && |
411 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[7],'UTF-8')->title_proper() eq 'World health statistics 2009^ien' && |
| 412 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' |
412 |
MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[18],'UTF-8')->title_proper() eq 'Manual de higiene industrial^ies' |
|
Lines 414-448
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 414 |
|
414 |
|
| 415 |
} elsif ( $indexing_mode eq 'grs1' ){ |
415 |
} elsif ( $indexing_mode eq 'grs1' ){ |
| 416 |
( undef, $results_hashref, $facets_loop ) = |
416 |
( undef, $results_hashref, $facets_loop ) = |
| 417 |
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
417 |
getRecords('salud', 'salud', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 418 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Efectos del ambiente/ && |
418 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Efectos del ambiente/ && |
| 419 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && |
419 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies' && |
| 420 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ |
420 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ |
| 421 |
, "Simple relevance sorting in getRecords matches old behavior"); |
421 |
, "Simple relevance sorting in getRecords matches old behavior"); |
| 422 |
|
422 |
|
| 423 |
( undef, $results_hashref, $facets_loop ) = |
423 |
( undef, $results_hashref, $facets_loop ) = |
| 424 |
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
424 |
getRecords('salud', 'salud', [ 'author_az' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 425 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/la enfermedad laboral\^ies$/ && |
425 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/la enfermedad laboral\^ies$/ && |
| 426 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[6])->title_proper() =~ m/^Indicadores de resultados identificados/ && |
426 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[6])->title_proper() =~ m/^Indicadores de resultados identificados/ && |
| 427 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'World health statistics 2009^ien' |
427 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'World health statistics 2009^ien' |
| 428 |
, "Simple ascending author sorting in getRecords matches old behavior"); |
428 |
, "Simple ascending author sorting in getRecords matches old behavior"); |
| 429 |
|
429 |
|
| 430 |
( undef, $results_hashref, $facets_loop ) = |
430 |
( undef, $results_hashref, $facets_loop ) = |
| 431 |
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
431 |
getRecords('salud', 'salud', [ 'author_za' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 432 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'World health statistics 2009^ien' && |
432 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'World health statistics 2009^ien' && |
| 433 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[12])->title_proper() =~ m/^Indicadores de resultados identificados/ && |
433 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[12])->title_proper() =~ m/^Indicadores de resultados identificados/ && |
| 434 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/la enfermedad laboral\^ies$/ |
434 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/la enfermedad laboral\^ies$/ |
| 435 |
, "Simple descending author sorting in getRecords matches old behavior"); |
435 |
, "Simple descending author sorting in getRecords matches old behavior"); |
| 436 |
|
436 |
|
| 437 |
( undef, $results_hashref, $facets_loop ) = |
437 |
( undef, $results_hashref, $facets_loop ) = |
| 438 |
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
438 |
getRecords('salud', 'salud', [ 'pubdate_asc' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 439 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'Manual de higiene industrial^ies' && |
439 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() eq 'Manual de higiene industrial^ies' && |
| 440 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && |
440 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() =~ m/seguridad e higiene del trabajo\^ies$/ && |
| 441 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ |
441 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() =~ m/^Indicadores de resultados identificados/ |
| 442 |
, "Simple ascending publication date sorting in getRecords matches old behavior"); |
442 |
, "Simple ascending publication date sorting in getRecords matches old behavior"); |
| 443 |
|
443 |
|
| 444 |
( undef, $results_hashref, $facets_loop ) = |
444 |
( undef, $results_hashref, $facets_loop ) = |
| 445 |
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
445 |
getRecords('salud', 'salud', [ 'pubdate_dsc' ], [ 'biblioserver' ], '38', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 446 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Estado de salud/ && |
446 |
ok(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper() =~ m/^Estado de salud/ && |
| 447 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'World health statistics 2009^ien' && |
447 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[7])->title_proper() eq 'World health statistics 2009^ien' && |
| 448 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'Manual de higiene industrial^ies' |
448 |
MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[18])->title_proper() eq 'Manual de higiene industrial^ies' |
|
Lines 450-456
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 450 |
} |
450 |
} |
| 451 |
|
451 |
|
| 452 |
( undef, $results_hashref, $facets_loop ) = |
452 |
( undef, $results_hashref, $facets_loop ) = |
| 453 |
getRecords('books', 'books', [ 'relevance' ], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, undef, 1); |
453 |
getRecords('books', 'books', [ 'relevance' ], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, undef, 1); |
| 454 |
$record = MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0]); |
454 |
$record = MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0]); |
| 455 |
is($record->title_proper(), 'Books', "Scan returned requested item"); |
455 |
is($record->title_proper(), 'Books', "Scan returned requested item"); |
| 456 |
is($record->subfield('100', 'a'), 2, "Scan returned correct number of records matching term"); |
456 |
is($record->subfield('100', 'a'), 2, "Scan returned correct number of records matching term"); |
|
Lines 464-470
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 464 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [], [], [], 0, 'en'); |
464 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [], [], [], 0, 'en'); |
| 465 |
like($query, qr/kw\W.*salud/, "Built CCL keyword query"); |
465 |
like($query, qr/kw\W.*salud/, "Built CCL keyword query"); |
| 466 |
|
466 |
|
| 467 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
467 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 468 |
is($results_hashref->{biblioserver}->{hits}, 19, "getRecords generated keyword search for 'salud' matched right number of records"); |
468 |
is($results_hashref->{biblioserver}->{hits}, 19, "getRecords generated keyword search for 'salud' matched right number of records"); |
| 469 |
|
469 |
|
| 470 |
my @newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 18, 0, 0, |
470 |
my @newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 18, 0, 0, |
|
Lines 476-482
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 476 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
476 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 477 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed explicit-and CCL keyword query"); |
477 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed explicit-and CCL keyword query"); |
| 478 |
|
478 |
|
| 479 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
479 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 480 |
is($results_hashref->{biblioserver}->{hits}, 3, "getRecords generated composed keyword search for 'salud' explicit-and 'higiene' matched right number of records"); |
480 |
is($results_hashref->{biblioserver}->{hits}, 3, "getRecords generated composed keyword search for 'salud' explicit-and 'higiene' matched right number of records"); |
| 481 |
|
481 |
|
| 482 |
( $error, $query, $simple_query, $query_cgi, |
482 |
( $error, $query, $simple_query, $query_cgi, |
|
Lines 484-490
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 484 |
$stopwords_removed, $query_type ) = buildQuery([ 'or' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
484 |
$stopwords_removed, $query_type ) = buildQuery([ 'or' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 485 |
like($query, qr/kw\W.*salud\W.*or.*kw\W.*higiene/, "Built composed explicit-or CCL keyword query"); |
485 |
like($query, qr/kw\W.*salud\W.*or.*kw\W.*higiene/, "Built composed explicit-or CCL keyword query"); |
| 486 |
|
486 |
|
| 487 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
487 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 488 |
is($results_hashref->{biblioserver}->{hits}, 20, "getRecords generated composed keyword search for 'salud' explicit-or 'higiene' matched right number of records"); |
488 |
is($results_hashref->{biblioserver}->{hits}, 20, "getRecords generated composed keyword search for 'salud' explicit-or 'higiene' matched right number of records"); |
| 489 |
|
489 |
|
| 490 |
( $error, $query, $simple_query, $query_cgi, |
490 |
( $error, $query, $simple_query, $query_cgi, |
|
Lines 492-498
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 492 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
492 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 493 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed implicit-and CCL keyword query"); |
493 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed implicit-and CCL keyword query"); |
| 494 |
|
494 |
|
| 495 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
495 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 496 |
is($results_hashref->{biblioserver}->{hits}, 3, "getRecords generated composed keyword search for 'salud' implicit-and 'higiene' matched right number of records"); |
496 |
is($results_hashref->{biblioserver}->{hits}, 3, "getRecords generated composed keyword search for 'salud' implicit-and 'higiene' matched right number of records"); |
| 497 |
|
497 |
|
| 498 |
( $error, $query, $simple_query, $query_cgi, |
498 |
( $error, $query, $simple_query, $query_cgi, |
|
Lines 501-507
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 501 |
like($query, qr/kw\W.*salud\W*and\W*su-to\W.*Laboratorios/, "Faceted query generated correctly"); |
501 |
like($query, qr/kw\W.*salud\W*and\W*su-to\W.*Laboratorios/, "Faceted query generated correctly"); |
| 502 |
unlike($query_desc, qr/Laboratorios/, "Facets not included in query description"); |
502 |
unlike($query_desc, qr/Laboratorios/, "Facets not included in query description"); |
| 503 |
|
503 |
|
| 504 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
504 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 505 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated faceted search matched right number of records"); |
505 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated faceted search matched right number of records"); |
| 506 |
|
506 |
|
| 507 |
|
507 |
|
|
Lines 509-515
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 509 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
509 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 510 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-itype:MP', 'mc-itype:MU' ], [], 0, 'en'); |
510 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-itype:MP', 'mc-itype:MU' ], [], 0, 'en'); |
| 511 |
|
511 |
|
| 512 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
512 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 513 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated mc-faceted search matched right number of records"); |
513 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated mc-faceted search matched right number of records"); |
| 514 |
|
514 |
|
| 515 |
|
515 |
|
|
Lines 517-529
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 517 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
517 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 518 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-loc:GEN', 'branch:FFL' ], [], 0, 'en'); |
518 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-loc:GEN', 'branch:FFL' ], [], 0, 'en'); |
| 519 |
|
519 |
|
| 520 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
520 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 521 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated multi-faceted search matched right number of records"); |
521 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated multi-faceted search matched right number of records"); |
| 522 |
|
522 |
|
| 523 |
( $error, $query, $simple_query, $query_cgi, |
523 |
( $error, $query, $simple_query, $query_cgi, |
| 524 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
524 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 525 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'NEKLS' ], [ 'Code-institution' ], [], [], 0, 'en'); |
525 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'NEKLS' ], [ 'Code-institution' ], [], [], 0, 'en'); |
| 526 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
526 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 527 |
is($results_hashref->{biblioserver}->{hits}, 12, |
527 |
is($results_hashref->{biblioserver}->{hits}, 12, |
| 528 |
'search using index whose name contains "ns" returns expected results (bug 10271)'); |
528 |
'search using index whose name contains "ns" returns expected results (bug 10271)'); |
| 529 |
|
529 |
|
|
Lines 531-542
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 531 |
( $error, $query, $simple_query, $query_cgi, |
531 |
( $error, $query, $simple_query, $query_cgi, |
| 532 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
532 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 533 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'book' ], [ 'kw' ], [], [], 0, 'en'); |
533 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'book' ], [ 'kw' ], [], [], 0, 'en'); |
| 534 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
534 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 535 |
is($results_hashref->{biblioserver}->{hits}, 101, "Search for 'book' with index set to 'kw' returns 101 hits"); |
535 |
is($results_hashref->{biblioserver}->{hits}, 101, "Search for 'book' with index set to 'kw' returns 101 hits"); |
| 536 |
( $error, $query, $simple_query, $query_cgi, |
536 |
( $error, $query, $simple_query, $query_cgi, |
| 537 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
537 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 538 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'book', 'another' ], [ 'kw', 'kw' ], [], [], 0, 'en'); |
538 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'book', 'another' ], [ 'kw', 'kw' ], [], [], 0, 'en'); |
| 539 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
539 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 540 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'kw:book && kw:another' returns 1 hit"); |
540 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'kw:book && kw:another' returns 1 hit"); |
| 541 |
$UseQueryParser = 0; |
541 |
$UseQueryParser = 0; |
| 542 |
|
542 |
|
|
Lines 546-552
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 546 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
546 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 547 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'available' ], [], 0, 'en'); |
547 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'available' ], [], 0, 'en'); |
| 548 |
|
548 |
|
| 549 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
549 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 550 |
is($results_hashref->{biblioserver}->{hits}, 26, "getRecords generated availability-limited search matched right number of records"); |
550 |
is($results_hashref->{biblioserver}->{hits}, 26, "getRecords generated availability-limited search matched right number of records"); |
| 551 |
|
551 |
|
| 552 |
@newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
552 |
@newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
|
Lines 562-589
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 562 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
562 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 563 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en'); |
563 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en'); |
| 564 |
|
564 |
|
| 565 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
565 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 566 |
is($results_hashref->{biblioserver}->{hits}, 180, "getRecords on _ALLRECORDS PQF returned all records"); |
566 |
is($results_hashref->{biblioserver}->{hits}, 180, "getRecords on _ALLRECORDS PQF returned all records"); |
| 567 |
|
567 |
|
| 568 |
( $error, $query, $simple_query, $query_cgi, |
568 |
( $error, $query, $simple_query, $query_cgi, |
| 569 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
569 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 570 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=1016 "Lessig"' ], [], [], [], 0, 'en'); |
570 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=1016 "Lessig"' ], [], [], [], 0, 'en'); |
| 571 |
|
571 |
|
| 572 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
572 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 573 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords PQF author search for Lessig returned proper number of matches"); |
573 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords PQF author search for Lessig returned proper number of matches"); |
| 574 |
|
574 |
|
| 575 |
( $error, $query, $simple_query, $query_cgi, |
575 |
( $error, $query, $simple_query, $query_cgi, |
| 576 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
576 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 577 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'ccl=au:Lessig' ], [], [], [], 0, 'en'); |
577 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'ccl=au:Lessig' ], [], [], [], 0, 'en'); |
| 578 |
|
578 |
|
| 579 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
579 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 580 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CCL author search for Lessig returned proper number of matches"); |
580 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CCL author search for Lessig returned proper number of matches"); |
| 581 |
|
581 |
|
| 582 |
( $error, $query, $simple_query, $query_cgi, |
582 |
( $error, $query, $simple_query, $query_cgi, |
| 583 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
583 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 584 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'cql=dc.author any lessig' ], [], [], [], 0, 'en'); |
584 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'cql=dc.author any lessig' ], [], [], [], 0, 'en'); |
| 585 |
|
585 |
|
| 586 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
586 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 587 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CQL author search for Lessig returned proper number of matches"); |
587 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CQL author search for Lessig returned proper number of matches"); |
| 588 |
|
588 |
|
| 589 |
$QueryStemming = $QueryAutoTruncate = $QueryFuzzy = $QueryRemoveStopwords = 0; |
589 |
$QueryStemming = $QueryAutoTruncate = $QueryFuzzy = $QueryRemoveStopwords = 0; |
|
Lines 592-598
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 592 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
592 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 593 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [], [], 0, 'en'); |
593 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [], [], 0, 'en'); |
| 594 |
|
594 |
|
| 595 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
595 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 596 |
is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); |
596 |
is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); |
| 597 |
if ($indexing_mode eq 'grs1') { |
597 |
if ($indexing_mode eq 'grs1') { |
| 598 |
is(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); |
598 |
is(MARC::Record::new_from_usmarc($results_hashref->{biblioserver}->{RECORDS}->[0])->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); |
|
Lines 607-620
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 607 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
607 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 608 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
608 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
| 609 |
|
609 |
|
| 610 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
610 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 611 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic' returns matches with automatic truncation on"); |
611 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic' returns matches with automatic truncation on"); |
| 612 |
|
612 |
|
| 613 |
( $error, $query, $simple_query, $query_cgi, |
613 |
( $error, $query, $simple_query, $query_cgi, |
| 614 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
614 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 615 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
615 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
| 616 |
|
616 |
|
| 617 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
617 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 618 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation on"); |
618 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation on"); |
| 619 |
|
619 |
|
| 620 |
$QueryStemming = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
620 |
$QueryStemming = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
|
Lines 622-634
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 622 |
( $error, $query, $simple_query, $query_cgi, |
622 |
( $error, $query, $simple_query, $query_cgi, |
| 623 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
623 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 624 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web application' ], [ 'kw' ], [], [], 0, 'en'); |
624 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web application' ], [ 'kw' ], [], [], 0, 'en'); |
| 625 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
625 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 626 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web application' returns one hit with QueryWeightFields on"); |
626 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web application' returns one hit with QueryWeightFields on"); |
| 627 |
|
627 |
|
| 628 |
( $error, $query, $simple_query, $query_cgi, |
628 |
( $error, $query, $simple_query, $query_cgi, |
| 629 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
629 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 630 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web "application' ], [ 'kw' ], [], [], 0, 'en'); |
630 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web "application' ], [ 'kw' ], [], [], 0, 'en'); |
| 631 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
631 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 632 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web \"application' returns one hit with QueryWeightFields on (bug 7518)"); |
632 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web \"application' returns one hit with QueryWeightFields on (bug 7518)"); |
| 633 |
|
633 |
|
| 634 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
634 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
|
Lines 636-649
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 636 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
636 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 637 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
637 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
| 638 |
|
638 |
|
| 639 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
639 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 640 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'medic' returns no matches with automatic truncation off"); |
640 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'medic' returns no matches with automatic truncation off"); |
| 641 |
|
641 |
|
| 642 |
( $error, $query, $simple_query, $query_cgi, |
642 |
( $error, $query, $simple_query, $query_cgi, |
| 643 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
643 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 644 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
644 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
| 645 |
|
645 |
|
| 646 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
646 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 647 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation off"); |
647 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation off"); |
| 648 |
|
648 |
|
| 649 |
$QueryStemming = $QueryWeightFields = 1; |
649 |
$QueryStemming = $QueryWeightFields = 1; |
|
Lines 652-658
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 652 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
652 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 653 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
653 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
| 654 |
|
654 |
|
| 655 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
655 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 656 |
is($results_hashref->{biblioserver}->{hits}, 7, "Search for 'pressed' returns matches when stemming (and query weighting) is on"); |
656 |
is($results_hashref->{biblioserver}->{hits}, 7, "Search for 'pressed' returns matches when stemming (and query weighting) is on"); |
| 657 |
|
657 |
|
| 658 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
658 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
|
Lines 660-666
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 660 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
660 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 661 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
661 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
| 662 |
|
662 |
|
| 663 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
663 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 664 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off"); |
664 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off"); |
| 665 |
|
665 |
|
| 666 |
# Let's see what happens when we pass bad data into these routines. |
666 |
# Let's see what happens when we pass bad data into these routines. |
|
Lines 671-686
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 671 |
isnt($error, undef, "SimpleSearch returns an error when passed gibberish"); |
671 |
isnt($error, undef, "SimpleSearch returns an error when passed gibberish"); |
| 672 |
|
672 |
|
| 673 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
673 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
| 674 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'nonsense', undef) } |
674 |
getRecords('kw:book', 'book', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, 'nonsense', undef) } |
| 675 |
qr/Unknown query_type/, "getRecords warns about unknown query type"; |
675 |
qr/Unknown query_type/, "getRecords warns about unknown query type"; |
| 676 |
|
676 |
|
| 677 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
677 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
| 678 |
getRecords('pqf=@attr 1=4 "title"', 'pqf=@attr 1=4 "title"', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, '', undef) } |
678 |
getRecords('pqf=@attr 1=4 "title"', 'pqf=@attr 1=4 "title"', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, '', undef) } |
| 679 |
qr/WARNING: query problem/, "getRecords warns when query type is not specified for non-CCL query"; |
679 |
qr/WARNING: query problem/, "getRecords warns when query type is not specified for non-CCL query"; |
| 680 |
|
680 |
|
| 681 |
# Let's just test a few other bits and bobs, just for fun |
681 |
# Let's just test a few other bits and bobs, just for fun |
| 682 |
|
682 |
|
| 683 |
($error, $results_hashref, $facets_loop) = getRecords("Godzina pąsowej róży","Godzina pąsowej róży",[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
683 |
($error, $results_hashref, $facets_loop) = getRecords("Godzina pąsowej róży","Godzina pąsowej róży",[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 684 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
684 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
| 685 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
685 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
| 686 |
is($newresults[0]->{'alternateholdings_count'}, 1, 'Alternate holdings filled in correctly'); |
686 |
is($newresults[0]->{'alternateholdings_count'}, 1, 'Alternate holdings filled in correctly'); |
|
Lines 699-712
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 699 |
} |
699 |
} |
| 700 |
}); |
700 |
}); |
| 701 |
|
701 |
|
| 702 |
($error, $results_hashref, $facets_loop) = getRecords("TEST12121212","TEST12121212",[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
702 |
($error, $results_hashref, $facets_loop) = getRecords("TEST12121212","TEST12121212",[ ], [ 'biblioserver' ],20,0,\%branches,\%itemtypes,$query_type,0); |
| 703 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
703 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 17, 0, 0, |
| 704 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
704 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
| 705 |
ok(!exists($newresults[0]->{norequests}), 'presence of a transit does not block hold request action (bug 10741)'); |
705 |
ok(!exists($newresults[0]->{norequests}), 'presence of a transit does not block hold request action (bug 10741)'); |
| 706 |
|
706 |
|
| 707 |
## Regression test for bug 10684 |
707 |
## Regression test for bug 10684 |
| 708 |
( undef, $results_hashref, $facets_loop ) = |
708 |
( undef, $results_hashref, $facets_loop ) = |
| 709 |
getRecords('ti:punctuation', 'punctuation', [], [ 'biblioserver' ], '19', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
709 |
getRecords('ti:punctuation', 'punctuation', [], [ 'biblioserver' ], '19', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 710 |
is($results_hashref->{biblioserver}->{hits}, 1, "search for ti:punctuation returned expected number of records"); |
710 |
is($results_hashref->{biblioserver}->{hits}, 1, "search for ti:punctuation returned expected number of records"); |
| 711 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 20, 0, 0, |
711 |
@newresults = searchResults('intranet', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 20, 0, 0, |
| 712 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
712 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
|
Lines 841-847
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 841 |
|
841 |
|
| 842 |
# retrieve records that are larger than the MARC limit of 99,999 octets |
842 |
# retrieve records that are larger than the MARC limit of 99,999 octets |
| 843 |
( undef, $results_hashref, $facets_loop ) = |
843 |
( undef, $results_hashref, $facets_loop ) = |
| 844 |
getRecords('ti:marc the large record', '', [], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef); |
844 |
getRecords('ti:marc the large record', '', [], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef); |
| 845 |
is($results_hashref->{biblioserver}->{hits}, 1, "Can do a search that retrieves an over-large bib record (bug 11096)"); |
845 |
is($results_hashref->{biblioserver}->{hits}, 1, "Can do a search that retrieves an over-large bib record (bug 11096)"); |
| 846 |
@newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 10, 0, 0, |
846 |
@newresults = searchResults('opac', $query_desc, $results_hashref->{'biblioserver'}->{'hits'}, 10, 0, 0, |
| 847 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
847 |
$results_hashref->{'biblioserver'}->{"RECORDS"}); |
|
Lines 858-864
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 858 |
# verify that we don't attempt to sort if no results were returned |
858 |
# verify that we don't attempt to sort if no results were returned |
| 859 |
# because of a query error |
859 |
# because of a query error |
| 860 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
860 |
warning_like {( undef, $results_hashref, $facets_loop ) = |
| 861 |
getRecords('ccl=( AND )', '', ['title_az'], [ 'biblioserver' ], '20', 0, undef, \%branches, \%itemtypes, 'ccl', undef) |
861 |
getRecords('ccl=( AND )', '', ['title_az'], [ 'biblioserver' ], '20', 0, \%branches, \%itemtypes, 'ccl', undef) |
| 862 |
} qr/WARNING: query problem with/, 'got warning instead of crash when attempting to run invalid query (bug 9578)'; |
862 |
} qr/WARNING: query problem with/, 'got warning instead of crash when attempting to run invalid query (bug 9578)'; |
| 863 |
|
863 |
|
| 864 |
# Test facet calculation |
864 |
# Test facet calculation |
|
Lines 889-910
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 889 |
# Test _get_facets_info |
889 |
# Test _get_facets_info |
| 890 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
890 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
| 891 |
my $expected_facets_info_marc21 = { |
891 |
my $expected_facets_info_marc21 = { |
| 892 |
'au' => { 'expanded' => undef, |
892 |
'au' => { 'label_value' => "Authors" }, |
| 893 |
'label_value' => "Authors" }, |
893 |
'holdingbranch' => { 'label_value' => "HoldingLibrary" }, |
| 894 |
'holdingbranch' => { 'expanded' => undef, |
894 |
'itype' => { 'label_value' => "ItemTypes" }, |
| 895 |
'label_value' => "HoldingLibrary" }, |
895 |
'location' => { 'label_value' => "Location" }, |
| 896 |
'itype' => { 'expanded' => undef, |
896 |
'se' => { 'label_value' => "Series" }, |
| 897 |
'label_value' => "ItemTypes" }, |
897 |
'su-geo' => { 'label_value' => "Places" }, |
| 898 |
'location' => { 'expanded' => undef, |
898 |
'su-to' => { 'label_value' => "Topics" }, |
| 899 |
'label_value' => "Location" }, |
899 |
'su-ut' => { 'label_value' => "Titles" } |
| 900 |
'se' => { 'expanded' => undef, |
|
|
| 901 |
'label_value' => "Series" }, |
| 902 |
'su-geo' => { 'expanded' => undef, |
| 903 |
'label_value' => "Places" }, |
| 904 |
'su-to' => { 'expanded' => undef, |
| 905 |
'label_value' => "Topics" }, |
| 906 |
'su-ut' => { 'expanded' => undef, |
| 907 |
'label_value' => "Titles" } |
| 908 |
}; |
900 |
}; |
| 909 |
is_deeply( $facets_info, $expected_facets_info_marc21, |
901 |
is_deeply( $facets_info, $expected_facets_info_marc21, |
| 910 |
"_get_facets_info returns the correct data"); |
902 |
"_get_facets_info returns the correct data"); |
|
Lines 984-1003
sub run_unimarc_search_tests {
Link Here
|
| 984 |
my $facets = C4::Koha::getFacets(); |
976 |
my $facets = C4::Koha::getFacets(); |
| 985 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
977 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
| 986 |
my $expected_facets_info_unimarc = { |
978 |
my $expected_facets_info_unimarc = { |
| 987 |
'au' => { 'expanded' => undef, |
979 |
'au' => { 'label_value' => "Authors" }, |
| 988 |
'label_value' => "Authors" }, |
980 |
'holdingbranch' => { 'label_value' => "HoldingLibrary" }, |
| 989 |
'holdingbranch' => { 'expanded' => undef, |
981 |
'location' => { 'label_value' => "Location" }, |
| 990 |
'label_value' => "HoldingLibrary" }, |
982 |
'se' => { 'label_value' => "Series" }, |
| 991 |
'location' => { 'expanded' => undef, |
983 |
'su-geo' => { 'label_value' => "Places" }, |
| 992 |
'label_value' => "Location" }, |
984 |
'su-to' => { 'label_value' => "Topics" }, |
| 993 |
'se' => { 'expanded' => undef, |
985 |
'su-ut' => { 'label_value' => "Titles" } |
| 994 |
'label_value' => "Series" }, |
|
|
| 995 |
'su-geo' => { 'expanded' => undef, |
| 996 |
'label_value' => "Places" }, |
| 997 |
'su-to' => { 'expanded' => undef, |
| 998 |
'label_value' => "Topics" }, |
| 999 |
'su-ut' => { 'expanded' => undef, |
| 1000 |
'label_value' => "Titles" } |
| 1001 |
}; |
986 |
}; |
| 1002 |
is_deeply( $facets_info, $expected_facets_info_unimarc, |
987 |
is_deeply( $facets_info, $expected_facets_info_unimarc, |
| 1003 |
"_get_facets_info returns the correct data"); |
988 |
"_get_facets_info returns the correct data"); |
| 1004 |
- |
|
|