mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
SEARCH-2460: Additional methods to perform operations and queries in SOLR (#99)
This commit is contained in:
@@ -67,6 +67,17 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
|||||||
return restWrapper.processTextResponse(request);
|
return restWrapper.processTextResponse(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes an action (like "delete") on SOLR alfresco core
|
||||||
|
* @param urlActionPath some action name (like "delete")
|
||||||
|
* @param queryBody parameters for the action
|
||||||
|
*/
|
||||||
|
public RestTextResponse postAction(String urlActionPath, String queryBody) throws Exception
|
||||||
|
{
|
||||||
|
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, queryBody, urlActionPath);
|
||||||
|
return restWrapper.processTextResponse(request);
|
||||||
|
}
|
||||||
|
|
||||||
public RestTextResponse getSelectQuery() throws Exception
|
public RestTextResponse getSelectQuery() throws Exception
|
||||||
{
|
{
|
||||||
List<Header> headers = new ArrayList<Header>();
|
List<Header> headers = new ArrayList<Header>();
|
||||||
@@ -77,4 +88,19 @@ public class SolrAPI extends ModelRequest<SolrAPI>
|
|||||||
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}", restWrapper.getParameters());
|
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}", restWrapper.getParameters());
|
||||||
return restWrapper.processTextResponse(request);
|
return restWrapper.processTextResponse(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a query in SOLR using JSON format for the results
|
||||||
|
*/
|
||||||
|
public RestTextResponse getSelectQueryJson() throws Exception
|
||||||
|
{
|
||||||
|
List<Header> headers = new ArrayList<Header>();
|
||||||
|
headers.add(new Header("Content-Type", "application/json"));
|
||||||
|
Headers header = new Headers(headers);
|
||||||
|
restWrapper.setResponseHeaders(header);
|
||||||
|
restWrapper.configureRequestSpec().setUrlEncodingEnabled(false);
|
||||||
|
RestRequest request = RestRequest.simpleRequest(HttpMethod.GET, "select?q={parameters}&wt=json", restWrapper.getParameters());
|
||||||
|
return restWrapper.processTextResponse(request);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user