Skip to content
Permalink
Browse files

combination of maximumRecords and cursor didn't work correct

  • Loading branch information...
guenterh committed Sep 5, 2018
1 parent 2aee5d2 commit f44443491fa115cd0473d168d5a94ecf30906665
Showing with 17 additions and 5 deletions.
  1. +17 −5 src/main/java/org/swissbib/sru/targets/solr/SOLRQueryTransformation.java
@@ -190,6 +190,16 @@ private void setQueryWindow(SolrQuery parameters) {
} else {
parameters.set("cursorMark",cursor);
}
try {
String rows = inputParams.getFirstValue("maximumRecords");

int maxRows = rows != null && rows.length() > 0 ? Integer.parseInt(rows) : 10;
parameters.set("rows", maxRows) ;
} catch (Exception ex) {

System.out.println("invalid rows parameter -> use 10 as default");
parameters.set("rows", 10) ;
}
parameters.set("sort","id asc");

return;
@@ -205,19 +215,21 @@ private void setQueryWindow(SolrQuery parameters) {

System.out.println("invalid start parameter -> use 0 as default");
}

parameters.set("start",startRecord);
//for backward compatibility - was 1 in the former version

String rows = inputParams.getFirstValue("maximumRecords");
int maxRows = 10;

try {
maxRows = rows != null && rows.length() > 0 ? Integer.parseInt(rows) : 0;
int maxRows = rows != null && rows.length() > 0 ? Integer.parseInt(rows) : 10;
parameters.set("rows", maxRows) ;
} catch (Exception ex) {

System.out.println("invalid rows parameter -> use 10 as default");
parameters.set("rows", 10) ;
}
parameters.set("start",startRecord);
parameters.set("rows", maxRows) ;




}

0 comments on commit f444434

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