Commit 0fe626b5 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

fluent pager

parent 925dadfe
Pipeline #135154 passed with stages
in 9 minutes and 16 seconds
......@@ -73,11 +73,13 @@ public class SearchController {
}
Response res = this.tgsearchClientService.search(realQueryString, order, start, limit, filter, sandbox);
Pager pager = new Pager();
pager.setHits(Integer.parseInt(res.getHits()));
pager.setLimit(limit);
pager.setStart(start);
Pager pager = new Pager()
.setHits(Integer.parseInt(res.getHits()))
.setLimit(limit)
.setStart(start);
pager.calculatePages();
model.addAttribute("pager", pager);
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
......@@ -93,7 +95,6 @@ public class SearchController {
model.addAttribute("start", start);
model.addAttribute("limit", limit);
model.addAttribute("filter", filter);
// model.addAttribute("basket", Utils.getBasketItems(renderRequest));
model.addAttribute("filterQueryString", Utils.getFilterQueryString(filter));
model.addAttribute("aggregatorUrl", this.tgrepConfig.getTextgridHost() + "/1.0/aggregator");
model.addAttribute("aggregatorSandboxParam", aggregatorSandboxParam);
......
......@@ -35,24 +35,27 @@ public class Pager {
return limit;
}
public void setLimit(int limit) {
public Pager setLimit(int limit) {
this.limit = limit;
return this;
}
public int getStart() {
return start;
}
public void setStart(int start) {
public Pager setStart(int start) {
this.start = start;
return this;
}
public int getHits() {
return hits;
}
public void setHits(int hits) {
public Pager setHits(int hits) {
this.hits = hits;
return this;
}
public Integer[] getPages() {
......
......@@ -52,7 +52,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
var term = $(termInput).val();
if(term != '' && term != true) {
if(term !== '' && term !== true) {
query += field + ':"' + term + '" OR ';
}
});
......@@ -73,7 +73,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
*/
if(ctypeArr.length > 0) {
if(query != "") query += ' AND ';
if(query !== "") query += ' AND ';
if(ctypeArr.length > 1) {
query += '(';
}
......@@ -93,9 +93,9 @@ document.addEventListener("DOMContentLoaded", function(event) {
/**
* fulltext
*/
if(fulltext != "") {
if(fulltext !== "") {
if(! $.isEmptyObject(fulltext)) {
if(query != "") {
if(query !== "") {
query += ' AND ';
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment