function tripal_pub_AGL_count

2.x tripal_pub.AGL.inc tripal_pub_AGL_count($yazc, $search_str)
3.x tripal_chado.pub_importer_AGL.inc tripal_pub_AGL_count($yazc, $search_str)
1.x AGL.inc tripal_pub_AGL_count($search_array)

Retrieves the total number of publications that match the search string.

Parameters

$yazc: The YAZC connection object.

$search_str: The search string to use for searching.

Return value

a count of the total number of publications that match the search string

1 call to tripal_pub_AGL_count()
tripal_pub_remote_search_AGL in tripal_chado/includes/loaders/tripal_chado.pub_importer_AGL.inc
A hook for performing the search on the AGL database.

File

tripal_chado/includes/loaders/tripal_chado.pub_importer_AGL.inc, line 490
This file provides support for importing and parsing of results from the USDA National Agricultural Library (AGL) database. The functions here are used by both the publication importer setup form and the publication importer. The USDA AGL database…

Code

function tripal_pub_AGL_count($yazc, $search_str) {

  //yaz_sort($yazc, "1=31 id"); // sort by publication date descending
  if (!yaz_search($yazc, "rpn", $search_str)) {
    $error_no = yaz_errno($yazc);
    $error_msg = yaz_error($yazc);
    $additional = yaz_addinfo($yazc);
    if ($additional != $error_msg) {
      $error_msg .= " $additional";
    }
    drupal_set_message("ERROR preparing search at AGL: ($error_no) $error_msg", "error");
    watchdog('tpub_import', "ERROR preparing search at AGL: (%error_no) %error_msg", 
    array('%error_no' => $error_no, '%error_msg' => $error_msg), WATCHDOG_ERROR);
    return 0;
  }
  if (!yaz_wait()) {
    $error_no = yaz_errno($yazc);
    $error_msg = yaz_error($yazc);
    $additional = yaz_addinfo($yazc);
    if ($additional != $error_msg) {
      $error_msg .= " $additional";
    }
    drupal_set_message("ERROR waiting on search at AGL: ($error_no) $error_msg", "error");
    watchdog('tpub_import', "ERROR waiting on search at AGL: (%error_no) %error_msg", 
    array('%error_no' => $error_no, '%error_msg' => $error_msg), WATCHDOG_ERROR);
    return 0;
  }

  // get the total number of results from the serach
  $count = yaz_hits($yazc);
  return $count;
}