use of org.alfresco.repo.search.impl.solr.SolrSQLJSONResultSet in project alfresco-remote-api by Alfresco.
the class SearchSQLApiWebscript method execute.
@Override
public void execute(WebScriptRequest webScriptRequest, WebScriptResponse res) throws IOException {
try {
// Turn JSON into a Java object representation
SearchSQLQuery searchQuery = extractJsonContent(webScriptRequest, assistant.getJsonHelper(), SearchSQLQuery.class);
SearchParameters sparams = buildSearchParameters(searchQuery);
ResultSet results = searchService.query(sparams);
FilteringResultSet frs = (FilteringResultSet) results;
SolrSQLJSONResultSet ssjr = (SolrSQLJSONResultSet) frs.getUnFilteredResultSet();
// When solr format is requested pass the solr output directly.
if (searchQuery.getFormat().equalsIgnoreCase("solr")) {
res.getWriter().write(ssjr.getSolrResponse());
} else {
CollectionWithPagingInfo<TupleList> nodes = resultMapper.toCollectionWithPagingInfo(ssjr.getDocs(), searchQuery);
renderJsonResponse(res, nodes, assistant.getJsonHelper());
}
setResponse(res, DEFAULT_SUCCESS);
} catch (Exception exception) {
renderException(exception, res, assistant);
}
}
Aggregations