</service:validatorHandler>
<service:properties xmlns:service="http://collectionspace.org/services/config/service">
<types:item xmlns:types="http://collectionspace.org/services/config/types">
- <types:key>fulltextquery</types:key>
- <types:value>SELECT ecm:uuid, ecm:primaryType FROM Document WHERE ecm:isProxy = 0 AND ecm:currentLifeCycleState <> 'deleted' ORDER BY ecm:uuid</types:value>
+ <types:key>fulltext</types:key>
+ <types:value>SELECT ecm:uuid, ecm:primaryType FROM Document WHERE ecm:isProxy = 0 ORDER BY ecm:uuid</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types">
+ <types:key>elasticsearch</types:key>
+ <types:value>SELECT ecm:uuid, ecm:primaryType FROM Document WHERE ecm:isProxy = 0 ORDER BY ecm:uuid</types:value>
</types:item>
</service:properties>
<service:object xmlns:service="http://collectionspace.org/services/config/service" name="Index"
if (success == false) {
Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
- ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceNotReindexedMsg(csid)).type("text/plain").build();
+ ServiceMessages.REINDEX_FAILED + ServiceMessages.indexResourceNotFoundMsg(indexid)).type("text/plain").build();
throw new CSWebApplicationException(response);
}
-
+
return result;
}
@Context UriInfo uriInfo,
@PathParam("indexid") String indexid) {
uriInfo = new UriInfoWrapper(uriInfo);
- Response result = Response.noContent().build();
+ Response result = Response.ok().build();
boolean success = false;
- String docType = null;
-
+
try {
RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = (RemoteServiceContext<PoxPayloadIn, PoxPayloadOut>) createServiceContext(uriInfo);
- docType = ctx.getTenantQualifiedDoctype(); // this will used in the error message if an error occurs
DocumentHandler handler = createDocumentHandler(ctx);
success = getRepositoryClient(ctx).reindex(handler, indexid);
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.REINDEX_FAILED);
}
-
+
if (success == false) {
Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
- ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceNotReindexedMsg(docType)).type("text/plain").build();
+ ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceTypeNotReindexedMsg(indexid)).type("text/plain").build();
throw new CSWebApplicationException(response);
}
-
+
return result;
}
public static String resourceNotFoundMsg(String csid) {
return String.format("The resource identified by CSID '%s' was not found.", csid);
}
+
+ public static String indexResourceNotFoundMsg(String indexId) {
+ return String.format("The index resource '%s' was not found.", indexId);
+ }
+
public static String resourceNotReindexedMsg(String csid) {
return String.format("The resource identified by CSID '%s' could not be reindexed. See the service logs for details.", csid);
*/
private boolean reindexElasticsearch(DocumentHandler handler, String csid, String indexid) throws NuxeoDocumentException, TransactionException {
boolean result = false;
+ if (!Framework.isBooleanPropertyTrue("elasticsearch.enabled")) {
+ logger.info("Request to reindex Elasticsearch failed because Elasticsearch is not enabled.");
+ return result;
+ }
+
CoreSessionInterface repoSession = null;
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = handler.getServiceContext();
-
+
try {
ElasticSearchIndexing esi = Framework.getService(ElasticSearchIndexing.class);
ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class);
@Context UriInfo uriInfo,
@PathParam("indexid") String indexid) {
uriInfo = new UriInfoWrapper(uriInfo);
- Response result = Response.noContent().build();
+ Response result = Response.ok().build();
boolean success = false;
String docType = null;
if (success == false) {
Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
- ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceNotReindexedMsg(docType)).type("text/plain").build();
+ ServiceMessages.REINDEX_FAILED + ServiceMessages.indexResourceNotFoundMsg(indexid)).type("text/plain").build();
throw new CSWebApplicationException(response);
}