use of org.xwiki.rest.XWikiRestException in project xwiki-platform by xwiki.
the class WikiSearchResourceImpl method search.
@Override
public SearchResults search(String wikiName, String keywords, List<String> searchScopeStrings, Integer number, Integer start, String orderField, String order, Boolean withPrettyNames) throws XWikiRestException {
try {
SearchResults searchResults = objectFactory.createSearchResults();
searchResults.setTemplate(String.format("%s?%s", Utils.createURI(uriInfo.getBaseUri(), WikiSearchResource.class, wikiName).toString(), SEARCH_TEMPLATE_INFO));
if (wikiName != null) {
Utils.getXWikiContext(componentManager).setWikiId(wikiName);
}
List<SearchScope> searchScopes = parseSearchScopeStrings(searchScopeStrings);
searchResults.getSearchResults().addAll(search(searchScopes, keywords, getXWikiContext().getWikiId(), null, Utils.getXWiki(componentManager).getRightService().hasProgrammingRights(Utils.getXWikiContext(componentManager)), number, start, true, orderField, order, withPrettyNames));
return searchResults;
} catch (Exception e) {
throw new XWikiRestException(e);
}
}
Aggregations