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

(-)a/C4/Search.pm (-26 / +10 lines)
Lines 310-332 sub SimpleSearch { Link Here
310
310
311
( undef, $results_hashref, \@facets_loop ) = getRecords (
311
( undef, $results_hashref, \@facets_loop ) = getRecords (
312
312
313
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
313
        $koha_query,       $simple_query, $sort_by_ref,         $servers_ref,
314
        $results_per_page, $offset,       $expanded_facet, $branches,$itemtypes,
314
        $results_per_page, $offset,       $branches,            $itemtypes,
315
        $query_type,       $scan
315
        $query_type,        $scan
316
    );
316
    );
317
317
318
The all singing, all dancing, multi-server, asynchronous, scanning,
318
The all singing, all dancing, multi-server, asynchronous, scanning,
319
searching, record nabbing, facet-building
319
searching, record nabbing, facet-building
320
320
321
See verbse embedded documentation.
321
See verbose embedded documentation.
322
322
323
=cut
323
=cut
324
324
325
sub getRecords {
325
sub getRecords {
326
    my (
326
    my (
327
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
327
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
328
        $results_per_page, $offset,       $expanded_facet, $branches,
328
        $results_per_page, $offset,       $branches,       $itemtypes,
329
        $itemtypes,        $query_type,   $scan,           $opac
329
        $query_type,   $scan,           $opac
330
    ) = @_;
330
    ) = @_;
331
331
332
    my @servers = @$servers_ref;
332
    my @servers = @$servers_ref;
Lines 511-518 sub getRecords { Link Here
511
                        keys %$facets_counter
511
                        keys %$facets_counter
512
                      )
512
                      )
513
                    {
513
                    {
514
                        my $expandable;
515
                        my $number_of_facets;
516
                        my @this_facets_array;
514
                        my @this_facets_array;
517
                        for my $one_facet (
515
                        for my $one_facet (
518
                            sort {
516
                            sort {
Lines 522-533 sub getRecords { Link Here
522
                            } keys %{ $facets_counter->{$link_value} }
520
                            } keys %{ $facets_counter->{$link_value} }
523
                          )
521
                          )
524
                        {
522
                        {
525
                            $number_of_facets++;
523
526
                            if (   ( $number_of_facets <= 5 )
527
                                || ( $expanded_facet eq $link_value )
528
                                || ( $facets_info->{$link_value}->{'expanded'} )
529
                              )
530
                            {
531
524
532
# Sanitize the link value : parenthesis, question and exclamation mark will cause errors with CCL
525
# Sanitize the link value : parenthesis, question and exclamation mark will cause errors with CCL
533
                                my $facet_link_value = $one_facet;
526
                                my $facet_link_value = $one_facet;
Lines 595-608 sub getRecords { Link Here
595
                                  }
588
                                  }
596
                                  if ($facet_label_value);
589
                                  if ($facet_label_value);
597
                            }
590
                            }
598
                        }
599
591
600
                        # handle expanded option
592
601
                        unless ( $facets_info->{$link_value}->{'expanded'} ) {
602
                            $expandable = 1
603
                              if ( ( $number_of_facets > 5 )
604
                                && ( $expanded_facet ne $link_value ) );
605
                        }
606
                        push @facets_loop,
593
                        push @facets_loop,
607
                          {
594
                          {
608
                            type_link_value => $link_value,
595
                            type_link_value => $link_value,
Lines 611-618 sub getRecords { Link Here
611
                              . $facets_info->{$link_value}->{'label_value'} =>
598
                              . $facets_info->{$link_value}->{'label_value'} =>
612
                              1,
599
                              1,
613
                            facets     => \@this_facets_array,
600
                            facets     => \@this_facets_array,
614
                            expandable => $expandable,
615
                            expand     => $link_value,
616
                          }
601
                          }
617
                          unless (
602
                          unless (
618
                            (
603
                            (
Lines 833-839 sub _get_facets_info { Link Here
833
818
834
    for my $facet ( @$facets ) {
819
    for my $facet ( @$facets ) {
835
        $facets_info->{ $facet->{ idx } }->{ label_value } = $facet->{ label };
820
        $facets_info->{ $facet->{ idx } }->{ label_value } = $facet->{ label };
836
        $facets_info->{ $facet->{ idx } }->{ expanded }    = $facet->{ expanded };
837
    }
821
    }
838
822
839
    return $facets_info;
823
    return $facets_info;
Lines 842-849 sub _get_facets_info { Link Here
842
sub pazGetRecords {
826
sub pazGetRecords {
843
    my (
827
    my (
844
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
828
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
845
        $results_per_page, $offset,       $expanded_facet, $branches,
829
        $results_per_page, $offset,       $branches,       $query_type,
846
        $query_type,       $scan
830
        $scan
847
    ) = @_;
831
    ) = @_;
848
832
849
    my $paz = C4::Search::PazPar2->new(C4::Context->config('pazpar2url'));
833
    my $paz = C4::Search::PazPar2->new(C4::Context->config('pazpar2url'));
(-)a/catalogue/search.pl (-2 / +1 lines)
Lines 479-485 my $offset = $params->{'offset'} || 0; Link Here
479
my $page = $cgi->param('page') || 1;
479
my $page = $cgi->param('page') || 1;
480
#my $offset = ($page-1)*$results_per_page;
480
#my $offset = ($page-1)*$results_per_page;
481
my $hits;
481
my $hits;
482
my $expanded_facet = $params->{'expand'};
483
482
484
# Define some global variables
483
# Define some global variables
485
my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
484
my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
Lines 530-536 my @results_array; Link Here
530
my $results_hashref;
529
my $results_hashref;
531
530
532
eval {
531
eval {
533
    ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan);
532
    ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$branches,$itemtypes,$query_type,$scan);
534
};
533
};
535
534
536
# This sorts the facets into alphabetical order
535
# This sorts the facets into alphabetical order
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (-5 / +11 lines)
Lines 22-28 Link Here
22
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
22
[% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %]
23
<ul>
23
<ul>
24
  [% FOREACH facet IN facets_loo.facets %]
24
  [% FOREACH facet IN facets_loo.facets %]
25
    <li>
25
      [% IF loop.count > 5 && !facet.active %]
26
          <li class="collapsible-facet" style='display:none'>
27
      [% ELSE %]
28
          <li>
29
      [% END %]
26
      [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
30
      [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %]
27
      [% IF ( sort_by ) %]
31
      [% IF ( sort_by ) %]
28
        [% url = BLOCK %][% url %][% "&amp;sort_by=" _ sort_by |url %][% END %]
32
        [% url = BLOCK %][% url %][% "&amp;sort_by=" _ sort_by |url %][% END %]
Lines 40-49 Link Here
40
      [% END %]
44
      [% END %]
41
    </li>
45
    </li>
42
  [% END %]
46
  [% END %]
43
  [% IF ( facets_loo.expandable ) %]
47
  [% IF facets_loo.facets.size > 5 %]
44
      <li class="showmore">
48
      <li class="moretoggle">
45
          <a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi %][% limit_cgi |url %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %][% IF ( offset ) %]
49
          Show more
46
                  &amp;offset=[% offset |url %][% END %]&amp;expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a>
50
      </li>
51
      <li class="moretoggle" style='display:none'>
52
          Show less
47
      </li>
53
      </li>
48
  [% END %]
54
  [% END %]
49
</ul></li>
55
</ul></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (+7 lines)
Lines 61-66 function cartList(){ Link Here
61
    }
61
    }
62
}
62
}
63
$(document).ready(function() {
63
$(document).ready(function() {
64
65
$(".moretoggle").click(function(){
66
    $(this).siblings(".collapsible-facet").toggle();
67
    $(this).siblings(".moretoggle").toggle();
68
    $(this).toggle();
69
});
70
64
$("#cartsubmit").click(function(){
71
$("#cartsubmit").click(function(){
65
    cartList();
72
    cartList();
66
    return false;
73
    return false;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc (-7 / +13 lines)
Lines 30-37 Link Here
30
                        [% END %]
30
                        [% END %]
31
                        [% IF facets_loo.type_label_Location %]<h5 id="facet-locations">Locations</h5>[% END %]
31
                        [% IF facets_loo.type_label_Location %]<h5 id="facet-locations">Locations</h5>[% END %]
32
                        <ul>
32
                        <ul>
33
                            [% FOREACH facet IN facets_loo.facets %]
33
                            [% FOREACH facet IN facets_loo.facets %] 
34
                                [% IF loop.count > 5 && !facet.active %]
35
                                <li class="collapsible-facet" style='display:none'>
36
                                [% ELSE %]
34
                                <li>
37
                                <li>
38
                                [% END %]
35
                                  [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %]
39
                                  [% SET url = "/cgi-bin/koha/opac-search.pl?" _ query_cgi _ limit_cgi %]
36
                                  [% IF ( sort_by ) %]
40
                                  [% IF ( sort_by ) %]
37
                                    [% url = BLOCK %][% url %][% "&amp;sort_by=" _ sort_by |url %][% END %]
41
                                    [% url = BLOCK %][% url %][% "&amp;sort_by=" _ sort_by |url %][% END %]
Lines 49-60 Link Here
49
                                  [% END %]
53
                                  [% END %]
50
                                </li>
54
                                </li>
51
                            [% END %]
55
                            [% END %]
52
                            [% IF ( facets_loo.expandable ) %]
56
                            [% IF facets_loo.facets.size > 5 %]
53
                                <li class="showmore">
57
                                 <li class="moretoggle">
54
                                    <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi |url %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |url %][% END %][% IF ( offset ) %]
58
                                   Show more
55
                                            &amp;offset=[% offset |url %][% END %]&amp;expand=[% facets_loo.expand |url %]#[% facets_loo.type_id |url %]">Show more</a>
59
                                 </li>
56
                                </li>
60
                                 <li class="moretoggle" style='display:none'>
57
                            [% END %]
61
                                   Show less
62
                                 </li>
63
                             [% END %]
58
                        </ul>
64
                        </ul>
59
                    </li>
65
                    </li>
60
                [% END # / IF facets_loo.facets.size > 0 %]
66
                [% END # / IF facets_loo.facets.size > 0 %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+9 lines)
Lines 691-703 function highlightOn() { Link Here
691
    $(".highlight_toggle").toggle();
691
    $(".highlight_toggle").toggle();
692
}
692
}
693
[% END %]
693
[% END %]
694
694
$(document).ready(function(){
695
$(document).ready(function(){
696
695
    [% IF ( OpacHighlightedWords ) %]
697
    [% IF ( OpacHighlightedWords ) %]
696
        $('a.title').each(function() {
698
        $('a.title').each(function() {
697
            $(this).attr("href", $(this).attr("href") + "&query_desc=[% query_desc | uri %]");
699
            $(this).attr("href", $(this).attr("href") + "&query_desc=[% query_desc | uri %]");
698
        });
700
        });
699
    [% END %]
701
    [% END %]
700
702
703
$(".moretoggle").click(function(){
704
    $(this).siblings(".collapsible-facet").toggle();
705
    $(this).siblings(".moretoggle").toggle();
706
    $(this).toggle();
707
});
708
709
701
    $(".cb").click(function(){
710
    $(".cb").click(function(){
702
      enableCheckboxActions();
711
      enableCheckboxActions();
703
    });
712
    });
(-)a/opac/opac-search.pl (-4 / +3 lines)
Lines 486-492 my $offset = $params->{'offset'} || 0; Link Here
486
my $page = $cgi->param('page') || 1;
486
my $page = $cgi->param('page') || 1;
487
$offset = ($page-1)*$results_per_page if $page>1;
487
$offset = ($page-1)*$results_per_page if $page>1;
488
my $hits;
488
my $hits;
489
my $expanded_facet = $params->{'expand'};
490
489
491
# Define some global variables
490
# Define some global variables
492
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
491
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
Lines 565-571 if ($tag) { Link Here
565
    # FIXME: No facets for tags search.
564
    # FIXME: No facets for tags search.
566
} elsif ($build_grouped_results) {
565
} elsif ($build_grouped_results) {
567
    eval {
566
    eval {
568
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
567
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$branches,$query_type,$scan);
569
    };
568
    };
570
} else {
569
} else {
571
    $pasarParams .= '&amp;query=' . uri_escape_utf8($query);
570
    $pasarParams .= '&amp;query=' . uri_escape_utf8($query);
Lines 573-579 if ($tag) { Link Here
573
    $pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
572
    $pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
574
    $pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
573
    $pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
575
    eval {
574
    eval {
576
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan,1);
575
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$branches,$itemtypes,$query_type,$scan,1);
577
    };
576
    };
578
}
577
}
579
# This sorts the facets into alphabetical order
578
# This sorts the facets into alphabetical order
Lines 581-587 if ($facets) { Link Here
581
    foreach my $f (@$facets) {
580
    foreach my $f (@$facets) {
582
        $f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
581
        $f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
583
    }
582
    }
584
    @$facets = sort {$a->{expand} cmp $b->{expand}} @$facets;
583
    @$facets = sort {$a->{type_link_value} cmp $b->{type_link_value}} @$facets;
585
}
584
}
586
585
587
# use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref);
586
# use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref);
(-)a/t/db_dependent/Search.t (-77 / +61 lines)
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
- 

Return to bug 14419