|
Lines 92-98
our $QueryStemming = 0;
Link Here
|
| 92 |
our $QueryAutoTruncate = 0; |
92 |
our $QueryAutoTruncate = 0; |
| 93 |
our $QueryWeightFields = 0; |
93 |
our $QueryWeightFields = 0; |
| 94 |
our $QueryFuzzy = 0; |
94 |
our $QueryFuzzy = 0; |
| 95 |
our $QueryRemoveStopwords = 0; |
|
|
| 96 |
our $UseQueryParser = 0; |
95 |
our $UseQueryParser = 0; |
| 97 |
our $marcflavour = 'MARC21'; |
96 |
our $marcflavour = 'MARC21'; |
| 98 |
our $contextmodule = new Test::MockModule('C4::Context'); |
97 |
our $contextmodule = new Test::MockModule('C4::Context'); |
|
Lines 108-115
$contextmodule->mock('preference', sub {
Link Here
|
| 108 |
return $QueryWeightFields; |
107 |
return $QueryWeightFields; |
| 109 |
} elsif ($pref eq 'QueryFuzzy') { |
108 |
} elsif ($pref eq 'QueryFuzzy') { |
| 110 |
return $QueryFuzzy; |
109 |
return $QueryFuzzy; |
| 111 |
} elsif ($pref eq 'QueryRemoveStopwords') { |
|
|
| 112 |
return $QueryRemoveStopwords; |
| 113 |
} elsif ($pref eq 'UseQueryParser') { |
110 |
} elsif ($pref eq 'UseQueryParser') { |
| 114 |
return $UseQueryParser; |
111 |
return $UseQueryParser; |
| 115 |
} elsif ($pref eq 'maxRecordsForFacets') { |
112 |
} elsif ($pref eq 'maxRecordsForFacets') { |
|
Lines 212-233
sub run_marc21_search_tests {
Link Here
|
| 212 |
$QueryAutoTruncate = 0; |
209 |
$QueryAutoTruncate = 0; |
| 213 |
$QueryWeightFields = 0; |
210 |
$QueryWeightFields = 0; |
| 214 |
$QueryFuzzy = 0; |
211 |
$QueryFuzzy = 0; |
| 215 |
$QueryRemoveStopwords = 0; |
|
|
| 216 |
$UseQueryParser = 0; |
212 |
$UseQueryParser = 0; |
| 217 |
$marcflavour = 'MARC21'; |
213 |
$marcflavour = 'MARC21'; |
| 218 |
|
214 |
|
| 219 |
foreach my $string ("Leçon","modèles") { |
|
|
| 220 |
my @results=C4::Search::_remove_stopwords($string,"kw"); |
| 221 |
$debug && warn "$string ",Dump(@results); |
| 222 |
ok($results[0] eq $string,"$string is not modified"); |
| 223 |
} |
| 224 |
|
| 225 |
foreach my $string ("A book about the stars") { |
| 226 |
my @results=C4::Search::_remove_stopwords($string,"kw"); |
| 227 |
$debug && warn "$string ",Dump(@results); |
| 228 |
ok($results[0] ne $string,"$results[0] from $string"); |
| 229 |
} |
| 230 |
|
| 231 |
my $indexes = C4::Search::getIndexes(); |
215 |
my $indexes = C4::Search::getIndexes(); |
| 232 |
is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported"); |
216 |
is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported"); |
| 233 |
|
217 |
|
|
Lines 434-443
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 434 |
|
418 |
|
| 435 |
my ( $query, $simple_query, $query_cgi, |
419 |
my ( $query, $simple_query, $query_cgi, |
| 436 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
420 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 437 |
$stopwords_removed, $query_type ); |
421 |
$query_type ); |
| 438 |
( $error, $query, $simple_query, $query_cgi, |
422 |
( $error, $query, $simple_query, $query_cgi, |
| 439 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
423 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 440 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [], [], [], 0, 'en'); |
424 |
$query_type ) = buildQuery([], [ 'salud' ], [], [], [], 0, 'en'); |
| 441 |
like($query, qr/kw\W.*salud/, "Built CCL keyword query"); |
425 |
like($query, qr/kw\W.*salud/, "Built CCL keyword query"); |
| 442 |
|
426 |
|
| 443 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
427 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
|
Lines 449-455
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 449 |
|
433 |
|
| 450 |
( $error, $query, $simple_query, $query_cgi, |
434 |
( $error, $query, $simple_query, $query_cgi, |
| 451 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
435 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 452 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
436 |
$query_type ) = buildQuery([ 'and' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 453 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed explicit-and CCL keyword query"); |
437 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed explicit-and CCL keyword query"); |
| 454 |
|
438 |
|
| 455 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
439 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
|
Lines 457-463
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 457 |
|
441 |
|
| 458 |
( $error, $query, $simple_query, $query_cgi, |
442 |
( $error, $query, $simple_query, $query_cgi, |
| 459 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
443 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 460 |
$stopwords_removed, $query_type ) = buildQuery([ 'or' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
444 |
$query_type ) = buildQuery([ 'or' ], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 461 |
like($query, qr/kw\W.*salud\W.*or.*kw\W.*higiene/, "Built composed explicit-or CCL keyword query"); |
445 |
like($query, qr/kw\W.*salud\W.*or.*kw\W.*higiene/, "Built composed explicit-or CCL keyword query"); |
| 462 |
|
446 |
|
| 463 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
447 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
|
Lines 465-471
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 465 |
|
449 |
|
| 466 |
( $error, $query, $simple_query, $query_cgi, |
450 |
( $error, $query, $simple_query, $query_cgi, |
| 467 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
451 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 468 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
452 |
$query_type ) = buildQuery([], [ 'salud', 'higiene' ], [], [], [], 0, 'en'); |
| 469 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed implicit-and CCL keyword query"); |
453 |
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed implicit-and CCL keyword query"); |
| 470 |
|
454 |
|
| 471 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
455 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
|
Lines 473-479
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 473 |
|
457 |
|
| 474 |
( $error, $query, $simple_query, $query_cgi, |
458 |
( $error, $query, $simple_query, $query_cgi, |
| 475 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
459 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 476 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [ 'su-to:Laboratorios' ], [], 0, 'en'); |
460 |
$query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [ 'su-to:Laboratorios' ], [], 0, 'en'); |
| 477 |
like($query, qr/kw\W.*salud\W*and\W*su-to\W.*Laboratorios/, "Faceted query generated correctly"); |
461 |
like($query, qr/kw\W.*salud\W*and\W*su-to\W.*Laboratorios/, "Faceted query generated correctly"); |
| 478 |
unlike($query_desc, qr/Laboratorios/, "Facets not included in query description"); |
462 |
unlike($query_desc, qr/Laboratorios/, "Facets not included in query description"); |
| 479 |
|
463 |
|
|
Lines 483-489
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 483 |
|
467 |
|
| 484 |
( $error, $query, $simple_query, $query_cgi, |
468 |
( $error, $query, $simple_query, $query_cgi, |
| 485 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
469 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 486 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-itype:MP', 'mc-itype:MU' ], [], 0, 'en'); |
470 |
$query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-itype:MP', 'mc-itype:MU' ], [], 0, 'en'); |
| 487 |
|
471 |
|
| 488 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
472 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 489 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated mc-faceted search matched right number of records"); |
473 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated mc-faceted search matched right number of records"); |
|
Lines 491-504
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 491 |
|
475 |
|
| 492 |
( $error, $query, $simple_query, $query_cgi, |
476 |
( $error, $query, $simple_query, $query_cgi, |
| 493 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
477 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 494 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-loc:GEN', 'branch:FFL' ], [], 0, 'en'); |
478 |
$query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'mc-loc:GEN', 'branch:FFL' ], [], 0, 'en'); |
| 495 |
|
479 |
|
| 496 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
480 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 497 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated multi-faceted search matched right number of records"); |
481 |
is($results_hashref->{biblioserver}->{hits}, 2, "getRecords generated multi-faceted search matched right number of records"); |
| 498 |
|
482 |
|
| 499 |
( $error, $query, $simple_query, $query_cgi, |
483 |
( $error, $query, $simple_query, $query_cgi, |
| 500 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
484 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 501 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'NEKLS' ], [ 'Code-institution' ], [], [], 0, 'en'); |
485 |
$query_type ) = buildQuery([], [ 'NEKLS' ], [ 'Code-institution' ], [], [], 0, 'en'); |
| 502 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
486 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 503 |
is($results_hashref->{biblioserver}->{hits}, 12, |
487 |
is($results_hashref->{biblioserver}->{hits}, 12, |
| 504 |
'search using index whose name contains "ns" returns expected results (bug 10271)'); |
488 |
'search using index whose name contains "ns" returns expected results (bug 10271)'); |
|
Lines 506-517
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 506 |
$UseQueryParser = 1; |
490 |
$UseQueryParser = 1; |
| 507 |
( $error, $query, $simple_query, $query_cgi, |
491 |
( $error, $query, $simple_query, $query_cgi, |
| 508 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
492 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 509 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'book' ], [ 'kw' ], [], [], 0, 'en'); |
493 |
$query_type ) = buildQuery([], [ 'book' ], [ 'kw' ], [], [], 0, 'en'); |
| 510 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
494 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 511 |
is($results_hashref->{biblioserver}->{hits}, 101, "Search for 'book' with index set to 'kw' returns 101 hits"); |
495 |
is($results_hashref->{biblioserver}->{hits}, 101, "Search for 'book' with index set to 'kw' returns 101 hits"); |
| 512 |
( $error, $query, $simple_query, $query_cgi, |
496 |
( $error, $query, $simple_query, $query_cgi, |
| 513 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
497 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 514 |
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'book', 'another' ], [ 'kw', 'kw' ], [], [], 0, 'en'); |
498 |
$query_type ) = buildQuery([ 'and' ], [ 'book', 'another' ], [ 'kw', 'kw' ], [], [], 0, 'en'); |
| 515 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
499 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 516 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'kw:book && kw:another' returns 1 hit"); |
500 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'kw:book && kw:another' returns 1 hit"); |
| 517 |
$UseQueryParser = 0; |
501 |
$UseQueryParser = 0; |
|
Lines 520-526
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 520 |
# are just checking that it behaves consistently |
504 |
# are just checking that it behaves consistently |
| 521 |
( $error, $query, $simple_query, $query_cgi, |
505 |
( $error, $query, $simple_query, $query_cgi, |
| 522 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
506 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 523 |
$stopwords_removed, $query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'available' ], [], 0, 'en'); |
507 |
$query_type ) = buildQuery([], [ '' ], [ 'kw' ], [ 'available' ], [], 0, 'en'); |
| 524 |
|
508 |
|
| 525 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
509 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 526 |
is($results_hashref->{biblioserver}->{hits}, 26, "getRecords generated availability-limited search matched right number of records"); |
510 |
is($results_hashref->{biblioserver}->{hits}, 26, "getRecords generated availability-limited search matched right number of records"); |
|
Lines 536-572
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 536 |
|
520 |
|
| 537 |
( $error, $query, $simple_query, $query_cgi, |
521 |
( $error, $query, $simple_query, $query_cgi, |
| 538 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
522 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 539 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en'); |
523 |
$query_type ) = buildQuery([], [ 'pqf=@attr 1=_ALLRECORDS @attr 2=103 ""' ], [], [], [], 0, 'en'); |
| 540 |
|
524 |
|
| 541 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
525 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 542 |
is($results_hashref->{biblioserver}->{hits}, 180, "getRecords on _ALLRECORDS PQF returned all records"); |
526 |
is($results_hashref->{biblioserver}->{hits}, 180, "getRecords on _ALLRECORDS PQF returned all records"); |
| 543 |
|
527 |
|
| 544 |
( $error, $query, $simple_query, $query_cgi, |
528 |
( $error, $query, $simple_query, $query_cgi, |
| 545 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
529 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 546 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pqf=@attr 1=1016 "Lessig"' ], [], [], [], 0, 'en'); |
530 |
$query_type ) = buildQuery([], [ 'pqf=@attr 1=1016 "Lessig"' ], [], [], [], 0, 'en'); |
| 547 |
|
531 |
|
| 548 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
532 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 549 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords PQF author search for Lessig returned proper number of matches"); |
533 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords PQF author search for Lessig returned proper number of matches"); |
| 550 |
|
534 |
|
| 551 |
( $error, $query, $simple_query, $query_cgi, |
535 |
( $error, $query, $simple_query, $query_cgi, |
| 552 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
536 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 553 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'ccl=au:Lessig' ], [], [], [], 0, 'en'); |
537 |
$query_type ) = buildQuery([], [ 'ccl=au:Lessig' ], [], [], [], 0, 'en'); |
| 554 |
|
538 |
|
| 555 |
($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,undef,\%branches,\%itemtypes,$query_type,0); |
| 556 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CCL author search for Lessig returned proper number of matches"); |
540 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CCL author search for Lessig returned proper number of matches"); |
| 557 |
|
541 |
|
| 558 |
( $error, $query, $simple_query, $query_cgi, |
542 |
( $error, $query, $simple_query, $query_cgi, |
| 559 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
543 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 560 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'cql=dc.author any lessig' ], [], [], [], 0, 'en'); |
544 |
$query_type ) = buildQuery([], [ 'cql=dc.author any lessig' ], [], [], [], 0, 'en'); |
| 561 |
|
545 |
|
| 562 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
546 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 563 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CQL author search for Lessig returned proper number of matches"); |
547 |
is($results_hashref->{biblioserver}->{hits}, 4, "getRecords CQL author search for Lessig returned proper number of matches"); |
| 564 |
|
548 |
|
| 565 |
$QueryStemming = $QueryAutoTruncate = $QueryFuzzy = $QueryRemoveStopwords = 0; |
549 |
$QueryStemming = $QueryAutoTruncate = $QueryFuzzy = 0; |
| 566 |
$QueryWeightFields = 1; |
550 |
$QueryWeightFields = 1; |
| 567 |
( $error, $query, $simple_query, $query_cgi, |
551 |
( $error, $query, $simple_query, $query_cgi, |
| 568 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
552 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 569 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [], [], 0, 'en'); |
553 |
$query_type ) = buildQuery([], [ 'salud' ], [ 'kw' ], [], [], 0, 'en'); |
| 570 |
|
554 |
|
| 571 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
555 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 572 |
is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); |
556 |
is($results_hashref->{biblioserver}->{hits}, 19, "Weighted query returned correct number of results"); |
|
Lines 577-640
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 577 |
is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); |
561 |
is(MARC::Record::new_from_xml($results_hashref->{biblioserver}->{RECORDS}->[0],'UTF-8')->title_proper(), 'Salud y seguridad de los trabajadores del sector salud: manual para gerentes y administradores^ies', "Weighted query returns best match first"); |
| 578 |
} |
562 |
} |
| 579 |
|
563 |
|
| 580 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = 0; |
564 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = 0; |
| 581 |
$QueryAutoTruncate = 1; |
565 |
$QueryAutoTruncate = 1; |
| 582 |
( $error, $query, $simple_query, $query_cgi, |
566 |
( $error, $query, $simple_query, $query_cgi, |
| 583 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
567 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 584 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
568 |
$query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
| 585 |
|
569 |
|
| 586 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
570 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 587 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic' returns matches with automatic truncation on"); |
571 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic' returns matches with automatic truncation on"); |
| 588 |
|
572 |
|
| 589 |
( $error, $query, $simple_query, $query_cgi, |
573 |
( $error, $query, $simple_query, $query_cgi, |
| 590 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
574 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 591 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
575 |
$query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
| 592 |
|
576 |
|
| 593 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
577 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 594 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation on"); |
578 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation on"); |
| 595 |
|
579 |
|
| 596 |
$QueryStemming = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
580 |
$QueryStemming = $QueryFuzzy = $QueryAutoTruncate = 0; |
| 597 |
$QueryWeightFields = 1; |
581 |
$QueryWeightFields = 1; |
| 598 |
( $error, $query, $simple_query, $query_cgi, |
582 |
( $error, $query, $simple_query, $query_cgi, |
| 599 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
583 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 600 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web application' ], [ 'kw' ], [], [], 0, 'en'); |
584 |
$query_type ) = buildQuery([], [ 'web application' ], [ 'kw' ], [], [], 0, 'en'); |
| 601 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
585 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 602 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web application' returns one hit with QueryWeightFields on"); |
586 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web application' returns one hit with QueryWeightFields on"); |
| 603 |
|
587 |
|
| 604 |
( $error, $query, $simple_query, $query_cgi, |
588 |
( $error, $query, $simple_query, $query_cgi, |
| 605 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
589 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 606 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'web "application' ], [ 'kw' ], [], [], 0, 'en'); |
590 |
$query_type ) = buildQuery([], [ 'web "application' ], [ 'kw' ], [], [], 0, 'en'); |
| 607 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
591 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 608 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web \"application' returns one hit with QueryWeightFields on (bug 7518)"); |
592 |
is($results_hashref->{biblioserver}->{hits}, 1, "Search for 'web \"application' returns one hit with QueryWeightFields on (bug 7518)"); |
| 609 |
|
593 |
|
| 610 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
594 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryAutoTruncate = 0; |
| 611 |
( $error, $query, $simple_query, $query_cgi, |
595 |
( $error, $query, $simple_query, $query_cgi, |
| 612 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
596 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 613 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
597 |
$query_type ) = buildQuery([], [ 'medic' ], [ 'kw' ], [], [], 0, 'en'); |
| 614 |
|
598 |
|
| 615 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
599 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 616 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'medic' returns no matches with automatic truncation off"); |
600 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'medic' returns no matches with automatic truncation off"); |
| 617 |
|
601 |
|
| 618 |
( $error, $query, $simple_query, $query_cgi, |
602 |
( $error, $query, $simple_query, $query_cgi, |
| 619 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
603 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 620 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
604 |
$query_type ) = buildQuery([], [ 'medic*' ], [ 'kw' ], [], [], 0, 'en'); |
| 621 |
|
605 |
|
| 622 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
606 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 623 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation off"); |
607 |
is($results_hashref->{biblioserver}->{hits}, 5, "Search for 'medic*' returns matches with automatic truncation off"); |
| 624 |
|
608 |
|
| 625 |
$QueryStemming = $QueryWeightFields = 1; |
609 |
$QueryStemming = $QueryWeightFields = 1; |
| 626 |
$QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
610 |
$QueryFuzzy = $QueryAutoTruncate = 0; |
| 627 |
( $error, $query, $simple_query, $query_cgi, |
611 |
( $error, $query, $simple_query, $query_cgi, |
| 628 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
612 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 629 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
613 |
$query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
| 630 |
|
614 |
|
| 631 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
615 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 632 |
is($results_hashref->{biblioserver}->{hits}, 7, "Search for 'pressed' returns matches when stemming (and query weighting) is on"); |
616 |
is($results_hashref->{biblioserver}->{hits}, 7, "Search for 'pressed' returns matches when stemming (and query weighting) is on"); |
| 633 |
|
617 |
|
| 634 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryRemoveStopwords = $QueryAutoTruncate = 0; |
618 |
$QueryStemming = $QueryWeightFields = $QueryFuzzy = $QueryAutoTruncate = 0; |
| 635 |
( $error, $query, $simple_query, $query_cgi, |
619 |
( $error, $query, $simple_query, $query_cgi, |
| 636 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
620 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 637 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
621 |
$query_type ) = buildQuery([], [ 'pressed' ], [ 'kw' ], [], [], 0, 'en'); |
| 638 |
|
622 |
|
| 639 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
623 |
($error, $results_hashref, $facets_loop) = getRecords($query,$simple_query,[ ], [ 'biblioserver' ],20,0,undef,\%branches,\%itemtypes,$query_type,0); |
| 640 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off"); |
624 |
is($results_hashref->{biblioserver}->{hits}, undef, "Search for 'pressed' returns no matches when stemming is off"); |
|
Lines 718-766
if ( $indexing_mode eq 'dom' ) {
Link Here
|
| 718 |
$term = 'Arizona'; |
702 |
$term = 'Arizona'; |
| 719 |
( $error, $query, $simple_query, $query_cgi, |
703 |
( $error, $query, $simple_query, $query_cgi, |
| 720 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
704 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 721 |
$stopwords_removed, $query_type ) = buildQuery([], [ $term ], [ 'su-br' ], [ ], [], 0, 'en'); |
705 |
$query_type ) = buildQuery([], [ $term ], [ 'su-br' ], [ ], [], 0, 'en'); |
| 722 |
matchesExplodedTerms("Advanced search for broader subjects", $query, 'Arizona', 'United States'); |
706 |
matchesExplodedTerms("Advanced search for broader subjects", $query, 'Arizona', 'United States'); |
| 723 |
|
707 |
|
| 724 |
( $error, $query, $simple_query, $query_cgi, |
708 |
( $error, $query, $simple_query, $query_cgi, |
| 725 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
709 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 726 |
$stopwords_removed, $query_type ) = buildQuery([], [ $term ], [ 'su-na' ], [ ], [], 0, 'en'); |
710 |
$query_type ) = buildQuery([], [ $term ], [ 'su-na' ], [ ], [], 0, 'en'); |
| 727 |
matchesExplodedTerms("Advanced search for narrower subjects", $query, 'Arizona', 'Maricopa County', 'Navajo County', 'Pima County'); |
711 |
matchesExplodedTerms("Advanced search for narrower subjects", $query, 'Arizona', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 728 |
|
712 |
|
| 729 |
( $error, $query, $simple_query, $query_cgi, |
713 |
( $error, $query, $simple_query, $query_cgi, |
| 730 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
714 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 731 |
$stopwords_removed, $query_type ) = buildQuery([], [ $term ], [ 'su-rl' ], [ ], [], 0, 'en'); |
715 |
$query_type ) = buildQuery([], [ $term ], [ 'su-rl' ], [ ], [], 0, 'en'); |
| 732 |
matchesExplodedTerms("Advanced search for related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
716 |
matchesExplodedTerms("Advanced search for related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 733 |
|
717 |
|
| 734 |
( $error, $query, $simple_query, $query_cgi, |
718 |
( $error, $query, $simple_query, $query_cgi, |
| 735 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
719 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 736 |
$stopwords_removed, $query_type ) = buildQuery([], [ "$term", 'history' ], [ 'su-rl', 'kw' ], [ ], [], 0, 'en'); |
720 |
$query_type ) = buildQuery([], [ "$term", 'history' ], [ 'su-rl', 'kw' ], [ ], [], 0, 'en'); |
| 737 |
matchesExplodedTerms("Advanced search for related subjects and keyword 'history' searches related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
721 |
matchesExplodedTerms("Advanced search for related subjects and keyword 'history' searches related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 738 |
like($query, qr/history/, "Advanced search for related subjects and keyword 'history' searches for 'history'"); |
722 |
like($query, qr/history/, "Advanced search for related subjects and keyword 'history' searches for 'history'"); |
| 739 |
|
723 |
|
| 740 |
( $error, $query, $simple_query, $query_cgi, |
724 |
( $error, $query, $simple_query, $query_cgi, |
| 741 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
725 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 742 |
$stopwords_removed, $query_type ) = buildQuery([], [ 'history', "$term" ], [ 'kw', 'su-rl' ], [ ], [], 0, 'en'); |
726 |
$query_type ) = buildQuery([], [ 'history', "$term" ], [ 'kw', 'su-rl' ], [ ], [], 0, 'en'); |
| 743 |
matchesExplodedTerms("Order of terms doesn't matter for advanced search", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
727 |
matchesExplodedTerms("Order of terms doesn't matter for advanced search", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 744 |
like($query, qr/history/, "Order of terms doesn't matter for advanced search"); |
728 |
like($query, qr/history/, "Order of terms doesn't matter for advanced search"); |
| 745 |
|
729 |
|
| 746 |
( $error, $query, $simple_query, $query_cgi, |
730 |
( $error, $query, $simple_query, $query_cgi, |
| 747 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
731 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 748 |
$stopwords_removed, $query_type ) = buildQuery([], [ "su-br($term)" ], [ ], [ ], [], 0, 'en'); |
732 |
$query_type ) = buildQuery([], [ "su-br($term)" ], [ ], [ ], [], 0, 'en'); |
| 749 |
matchesExplodedTerms("Simple search for broader subjects", $query, 'Arizona', 'United States'); |
733 |
matchesExplodedTerms("Simple search for broader subjects", $query, 'Arizona', 'United States'); |
| 750 |
|
734 |
|
| 751 |
( $error, $query, $simple_query, $query_cgi, |
735 |
( $error, $query, $simple_query, $query_cgi, |
| 752 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
736 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 753 |
$stopwords_removed, $query_type ) = buildQuery([], [ "su-na($term)" ], [ ], [ ], [], 0, 'en'); |
737 |
$query_type ) = buildQuery([], [ "su-na($term)" ], [ ], [ ], [], 0, 'en'); |
| 754 |
matchesExplodedTerms("Simple search for narrower subjects", $query, 'Arizona', 'Maricopa County', 'Navajo County', 'Pima County'); |
738 |
matchesExplodedTerms("Simple search for narrower subjects", $query, 'Arizona', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 755 |
|
739 |
|
| 756 |
( $error, $query, $simple_query, $query_cgi, |
740 |
( $error, $query, $simple_query, $query_cgi, |
| 757 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
741 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 758 |
$stopwords_removed, $query_type ) = buildQuery([], [ "su-rl($term)" ], [ ], [ ], [], 0, 'en'); |
742 |
$query_type ) = buildQuery([], [ "su-rl($term)" ], [ ], [ ], [], 0, 'en'); |
| 759 |
matchesExplodedTerms("Simple search for related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
743 |
matchesExplodedTerms("Simple search for related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 760 |
|
744 |
|
| 761 |
( $error, $query, $simple_query, $query_cgi, |
745 |
( $error, $query, $simple_query, $query_cgi, |
| 762 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
746 |
$query_desc, $limit, $limit_cgi, $limit_desc, |
| 763 |
$stopwords_removed, $query_type ) = buildQuery([], [ "history && su-rl($term)" ], [ ], [ ], [], 0, 'en'); |
747 |
$query_type ) = buildQuery([], [ "history && su-rl($term)" ], [ ], [ ], [], 0, 'en'); |
| 764 |
matchesExplodedTerms("Simple search for related subjects and keyword 'history' searches related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
748 |
matchesExplodedTerms("Simple search for related subjects and keyword 'history' searches related subjects", $query, 'Arizona', 'United States', 'Maricopa County', 'Navajo County', 'Pima County'); |
| 765 |
like($query, qr/history/, "Simple search for related subjects and keyword 'history' searches for 'history'"); |
749 |
like($query, qr/history/, "Simple search for related subjects and keyword 'history' searches for 'history'"); |
| 766 |
|
750 |
|
|
Lines 907-913
sub run_unimarc_search_tests {
Link Here
|
| 907 |
$QueryAutoTruncate = 0; |
891 |
$QueryAutoTruncate = 0; |
| 908 |
$QueryWeightFields = 0; |
892 |
$QueryWeightFields = 0; |
| 909 |
$QueryFuzzy = 0; |
893 |
$QueryFuzzy = 0; |
| 910 |
$QueryRemoveStopwords = 0; |
|
|
| 911 |
$UseQueryParser = 0; |
894 |
$UseQueryParser = 0; |
| 912 |
$marcflavour = 'UNIMARC'; |
895 |
$marcflavour = 'UNIMARC'; |
| 913 |
|
896 |
|