int start = (wbRequest.getPageNum()-1) * hitsPerPage;
if (urlStr == null || urlStr.length() <= 0) {
throw new BadQueryException("Url is empty.");
}
// Construct the search url.
MutableString ms = new MutableString(this.searchUrlBase)
.append("?query=");
// Add 'date:...+' to query string.
ms.append("date%3A").append(startDateStr).append('-').append(endDateStr);
ms.append('+');
// Add 'url:URL'.
if(wbRequest.isUrlQueryRequest()) {
ms.append("url%3A");
} else {
ms.append("exacturl%3A");
}
try {
ms.append(java.net.URLEncoder.encode("\""+urlStr+"\"", "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new BadQueryException(e.toString());
}
ms.append("&hitsPerPage=").append(hitsPerPage);
ms.append("&start=").append(start);
ms.append("&dedupField=site");
// As we are always searching agains an url, a
// higher perDup/Site will return just more versions
ms.append("&hitsPerDup=").append(hitsPerPage);
ms.append("&hitsPerSite=").append(hitsPerPage);
return ms.toString();
}