StringTokenizer terms = new StringTokenizer("");
if(searchForm.getQuery() != null && !("").equals(searchForm.getQuery())) {
terms = new StringTokenizer(searchForm.getQuery().trim());
}
SearchParamsImpl params = new SearchParamsImpl();
params.addParam(PARAM.CLIENT, gsa_client);
params.addParam(PARAM.SEARCH_URI, this.serviceLocator.getAppConfigurationService().
getGlobalConfiguration().getSearchUri());
params.addParam(PARAM.BASE_COLLECTION_NAME, this.serviceLocator.getAppConfigurationService().
getGlobalConfiguration().getSearchBaseCollectionName());
params.addParam(PARAM.LANG, locale.getLanguage());
if(searchForm.getInMeta() != null && !"".equals(searchForm.getInMeta())) {
String urlEndodedField = URLEncoder.encode(searchForm.getInMeta(), "UTF-8"); // Url encoding
params.addParam(PARAM.INMETA, urlEndodedField);
//query = new StringBuffer(query).append("".equals(query) ? "" : " ").append(searchForm.getInMeta()).toString();
}
//params.addParam(PARAM.START, start != null ? start.toString() : "");
PageManager<ISearchResults> paginator = new PageManager<ISearchResults>();
paginator.setStart((page-1)*paginator.getOffset());
params.addParam(PARAM.START, String.valueOf(paginator.getStart()));
this.serviceLocator.getSearchEngine().search(terms, params);
ISearchResults results = this.serviceLocator.getSearchEngine().getSearchResults();
paginator.setCollection((Collection)results);
try {
paginator.setSize(Long.parseLong(results.getTotalResults()));