Skip to content
Permalink
Browse files

Add text search for GBV and LoC (#1619)

  • Loading branch information...
mrtcode authored and dstillman committed Apr 18, 2018
1 parent a3bbac5 commit 79c2ecc9ff0890706350209341820430b148ba80
Showing with 23 additions and 6 deletions.
  1. +12 −4 Gemeinsamer Bibliotheksverbund ISBN.js
  2. +11 −2 Library of Congress ISBN.js
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 8,
"browserSupport": "gcsibv",
"lastUpdated": "2017-09-17 23:54:00"
"lastUpdated": "2018-04-13 13:41:00"
}

/*
@@ -40,10 +40,18 @@ function detectSearch(item) {
}

function doSearch(item) {
var queryISBN = ZU.cleanISBN(item.ISBN);
//search the ISBN over the SRU of the GBV, and take the result it as MARCXML
//search the ISBN or text over the SRU of the GBV, and take the result it as MARCXML
//documentation: https://www.gbv.de/wikis/cls/SRU
var url = "http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.isb=" + queryISBN + " AND pica.mat%3DB&maximumRecords=1";

let url;
if (item.ISBN) {
var queryISBN = ZU.cleanISBN(item.ISBN);
url = "http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.isb=" + queryISBN + " AND pica.mat%3DB&maximumRecords=1";
}
else if (item.query) {
url = "http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=" + encodeURIComponent(item.query) + "&maximumRecords=50";
}

//Z.debug(url);
ZU.doGet(url, function (text) {
//Z.debug(text);
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 8,
"browserSupport": "gcsibv",
"lastUpdated": "2017-06-03 11:41:00"
"lastUpdated": "2018-04-13 13:41:00"
}


@@ -25,7 +25,16 @@ function detectSearch(item) {
function doSearch(item) {
//Sends an SRU formatted as CQL to the library of Congress asking for marcXML back
//http://www.loc.gov/standards/sru/
ZU.doGet("http://lx2.loc.gov:210/LCDB?operation=searchRetrieve&version=1.1&query=bath.ISBN=^" + ZU.cleanISBN(item.ISBN) + "&maximumRecords=1", function (text) {

let url;
if (item.ISBN) {
url = "http://lx2.loc.gov:210/LCDB?operation=searchRetrieve&version=1.1&query=bath.ISBN=^" + ZU.cleanISBN(item.ISBN) + "&maximumRecords=1";
}
else if (item.query) {
url = "http://lx2.loc.gov:210/LCDB?operation=searchRetrieve&version=1.1&query=" + encodeURIComponent(item.query) + "&maximumRecords=50";
}

ZU.doGet(url, function (text) {
//Z.debug(text);
var translator = Zotero.loadTranslator("import");
translator.setTranslator("edd87d07-9194-42f8-b2ad-997c4c7deefd");

0 comments on commit 79c2ecc

Please sign in to comment.
You can’t perform that action at this time.