Skip to content

Commit

Permalink
Fix GVK Fetcher url
Browse files Browse the repository at this point in the history
Fixes Part of #10160

compare code attributes in xml with ignore case
  • Loading branch information
Siedlerchr committed Aug 18, 2023
1 parent 03b3f25 commit 7a516f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class GvkFetcher implements SearchBasedParserFetcher {

private static final String URL_PATTERN = "http://sru.gbv.de/gvk?";
private static final String URL_PATTERN = "https://sru.k10plus.de/gvk?";

/**
* Searchkeys are used to specify a search request. For example "tit" stands for "title".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ private String getSubfield(String a, Element datafield) {
List<Element> liste = getChildren("subfield", datafield);

for (Element subfield : liste) {
if (subfield.getAttribute("code").equals(a)) {
if (subfield.getAttribute("code").equalsIgnoreCase(a)) {
return subfield.getTextContent();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public void setUp() {
.withField(StandardField.PUBLISHER, "Addison-Wesley")
.withField(StandardField.YEAR, "2008")
.withField(StandardField.AUTHOR, "Joshua Bloch")
.withField(StandardField.SERIES, "The @Java series")
.withField(StandardField.ADDRESS, "Upper Saddle River, NJ [u.a.]")
.withField(StandardField.SERIES, "The Java series ... from the source")
.withField(StandardField.ADDRESS, "Upper Saddle River, NJ")
.withField(StandardField.EDITION, "2. ed., 5. print.")
.withField(StandardField.NOTE, "Literaturverz. S. 321 - 325")
.withField(StandardField.NOTE, "Includes bibliographical references and index. - Previous ed.: 2001. - Hier auch später erschienene, unveränderte Nachdrucke")
.withField(StandardField.ISBN, "9780321356680")
.withField(StandardField.PAGETOTAL, "XXI, 346")
.withField(new UnknownField("ppn_gvk"), "591166003")
Expand Down Expand Up @@ -67,15 +67,15 @@ public void simpleSearchQueryURLCorrect() throws Exception {
String query = "java jdk";
QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD);
URL url = fetcher.getURLForQuery(luceneQuery);
assertEquals("http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.all%3Djava+and+pica.all%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
assertEquals("https://sru.k10plus.de/gvk?version=1.1&operation=searchRetrieve&query=pica.all%3Djava+and+pica.all%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
}

@Test
public void complexSearchQueryURLCorrect() throws Exception {
String query = "kon:java tit:jdk";
QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD);
URL url = fetcher.getURLForQuery(luceneQuery);
assertEquals("http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.kon%3Djava+and+pica.tit%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
assertEquals("https://sru.k10plus.de/gvk?version=1.1&operation=searchRetrieve&query=pica.kon%3Djava+and+pica.tit%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
}

@Test
Expand Down

0 comments on commit 7a516f6

Please sign in to comment.