Search in sources :

Example 1 with JSONResult

use of org.alfresco.repo.search.impl.lucene.JSONResult in project alfresco-repository by Alfresco.

the class SolrQueryHTTPClient method postSolrQuery.

protected JSONResult postSolrQuery(HttpClient httpClient, String url, JSONObject body, SolrJsonProcessor<?> jsonProcessor, String spellCheckParams) throws UnsupportedEncodingException, IOException, HttpException, URIException, JSONException {
    JSONObject json = postQuery(httpClient, url, body);
    if (spellCheckParams != null) {
        SpellCheckDecisionManager manager = new SpellCheckDecisionManager(json, url, body, spellCheckParams);
        if (manager.isCollate()) {
            json = postQuery(httpClient, manager.getUrl(), body);
        }
        json.put("spellcheck", manager.getSpellCheckJsonValue());
    }
    JSONResult results = jsonProcessor.getResult(json);
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Sent :" + url);
        s_logger.debug("   with: " + body.toString());
        s_logger.debug("Got: " + results.getNumberFound() + " in " + results.getQueryTime() + " ms");
    }
    return results;
}
Also used : JSONObject(org.json.JSONObject) JSONResult(org.alfresco.repo.search.impl.lucene.JSONResult)

Example 2 with JSONResult

use of org.alfresco.repo.search.impl.lucene.JSONResult in project alfresco-repository by Alfresco.

the class SolrSQLHttpClient method postSolrQuery.

protected ResultSet postSolrQuery(HttpClient httpClient, String url, JSONObject body, SolrJsonProcessor<?> jsonProcessor) throws IOException, JSONException {
    JSONObject json = postQuery(httpClient, url, body);
    JSONResult results = jsonProcessor.getResult(json);
    LOGGER.debug("Sent : {}", url);
    LOGGER.debug("with: {}", body);
    LOGGER.debug("Got: {} in {} ms", results.getNumberFound(), results.getQueryTime());
    return (ResultSet) results;
}
Also used : JSONObject(org.json.JSONObject) JSONResult(org.alfresco.repo.search.impl.lucene.JSONResult) ResultSet(org.alfresco.service.cmr.search.ResultSet) StatsResultSet(org.alfresco.service.cmr.search.StatsResultSet)

Aggregations

JSONResult (org.alfresco.repo.search.impl.lucene.JSONResult)2 JSONObject (org.json.JSONObject)2 ResultSet (org.alfresco.service.cmr.search.ResultSet)1 StatsResultSet (org.alfresco.service.cmr.search.StatsResultSet)1