Skip to content

Commit

Permalink
added skipIndexed
Browse files Browse the repository at this point in the history
  • Loading branch information
scolapasta committed Apr 2, 2015
1 parent 0d07f0d commit 772813e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/api/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public class Index extends AbstractApiBean {

@GET
public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitionsSelected, @QueryParam("partitionIdToProcess") Long partitionIdToProcess, @QueryParam("previewOnly") boolean previewOnly) {
return indexAllOrSubset(numPartitionsSelected, partitionIdToProcess, false, previewOnly);
}

@GET
@Path("continue")
public Response indexAllOrSubsetContinue(@QueryParam("numPartitions") Long numPartitionsSelected, @QueryParam("partitionIdToProcess") Long partitionIdToProcess, @QueryParam("previewOnly") boolean previewOnly) {
return indexAllOrSubset(numPartitionsSelected, partitionIdToProcess, true, previewOnly);
}

private Response indexAllOrSubset(Long numPartitionsSelected, Long partitionIdToProcess, boolean skipIndexed, boolean previewOnly) {
try {
long numPartitions = 1;
if (numPartitionsSelected != null) {
Expand Down Expand Up @@ -113,7 +123,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions
availablePartitionIdsBuilder.add(i);
}

JsonObjectBuilder preview = indexAllService.indexAllOrSubsetPreview(numPartitions, partitionIdToProcess);
JsonObjectBuilder preview = indexAllService.indexAllOrSubsetPreview(numPartitions, partitionIdToProcess, skipIndexed);
if (previewOnly) {
preview.add("args", args);
preview.add("availablePartitionIds", availablePartitionIdsBuilder);
Expand All @@ -127,7 +137,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions
* @todo How can we expose the String returned from "index all" via
* the API?
*/
Future<JsonObjectBuilder> indexAllFuture = indexAllService.indexAllOrSubset(numPartitions, partitionIdToProcess, previewOnly);
Future<JsonObjectBuilder> indexAllFuture = indexAllService.indexAllOrSubset(numPartitions, partitionIdToProcess, skipIndexed, previewOnly);
JsonObject workloadPreview = preview.build().getJsonObject("previewOfPartitionWorkload");
int dataverseCount = workloadPreview.getInt("dataverseCount");
int datasetCount = workloadPreview.getInt("datasetCount");
Expand Down Expand Up @@ -167,7 +177,7 @@ public Response indexAllOrSubset(@QueryParam("numPartitions") Long numPartitions
}
}
}

@GET
@Path("{type}/{id}")
public Response indexTypeById(@PathParam("type") String type, @PathParam("id") Long id) {
Expand Down

0 comments on commit 772813e

Please sign in to comment.