Bug 12478: starting authority search in staff client
[koha.git] / authorities / authorities-home.pl
index 9e80489..53e1fa4 100755 (executable)
@@ -29,7 +29,7 @@ use C4::Auth;
 use C4::Output;
 use C4::AuthoritiesMarc;
 use C4::Acquisition;
-use C4::Koha;    # XXX subfield_is_koha_internal_p
+use C4::Koha;
 use C4::Biblio;
 use C4::Search::History;
 
@@ -77,13 +77,24 @@ if ( $op eq "do_search" ) {
     my $startfrom      = $query->param('startfrom')      || 1;
     my $resultsperpage = $query->param('resultsperpage') || 20;
 
-    my ( $results, $total ) = SearchAuthorities(
-        [$marclist],  [$and_or],
-        [$excluding], [$operator],
-        [$value], ( $startfrom - 1 ) * $resultsperpage,
-        $resultsperpage, $authtypecode,
-        $orderby
+    my $builder  = Koha::SearchEngine::QueryBuilder->new();
+    my $searcher = Koha::SearchEngine::Search->new({index => 'authorities'});
+    my $search_query = $builder->build_authorities_query_compat(
+        [$marclist], [$and_or], [$excluding], [$operator],
+        [$value], $authtypecode, $orderby
     );
+    $startfrom = $startfrom // 0;
+    my ( $results, $total ) =
+      $searcher->search_auth_compat( $search_query, $startfrom + 1,
+        $resultsperpage );
+
+    #my ( $results, $total ) = SearchAuthorities(
+    #    [$marclist],  [$and_or],
+    #    [$excluding], [$operator],
+    #    [$value], ( $startfrom - 1 ) * $resultsperpage,
+    #    $resultsperpage, $authtypecode,
+    #    $orderby
+    #);
 
 
     ( $template, $loggedinuser, $cookie ) = get_template_and_user(