Ejemplo n.º 1
0
  private String getPreviousPageURL(Request request) {
    // If our offset should be 0 then we shouldn't be able to view a previous page url
    if (0 == queryArgs.getFacetOffset()) {
      return null;
    }

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
    if (queryArgs.getFacetOffset() != -1) {
      parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() - DEFAULT_PAGE_SIZE));
    }

    // Add the filter queries
    String url = generateURL("browse-discovery", parameters);
    String[] fqs = getParameterFacetQueries();
    if (fqs != null) {
      StringBuilder urlBuilder = new StringBuilder(url);
      for (String fq : fqs) {
        urlBuilder.append("&fq=").append(fq);
      }

      url = urlBuilder.toString();
    }

    return url;
  }
Ejemplo n.º 2
0
  private String getNextPageURL(Request request) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
    if (queryArgs.getFacetOffset() != -1) {
      parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() + DEFAULT_PAGE_SIZE));
    }

    // Add the filter queries
    String url = generateURL("browse-discovery", parameters);
    String[] fqs = getParameterFacetQueries();
    if (fqs != null) {
      StringBuilder urlBuilder = new StringBuilder(url);
      for (String fq : fqs) {
        urlBuilder.append("&fq=").append(fq);
      }

      url = urlBuilder.toString();
    }

    return url;
  }