Added coreName in nodeParameters Added coreName in propertyBag (shardState)

This commit is contained in:
eliaporciani
2019-05-23 11:27:22 +02:00
committed by Tom Page
parent 3ccaca0e3a
commit f78b0ecfd7
3 changed files with 24 additions and 2 deletions

View File

@@ -20,9 +20,11 @@ package org.alfresco.solr.tracker;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -197,6 +199,9 @@ public class MetadataTracker extends AbstractTracker implements Tracker
private ShardState getShardState()
{
TrackerState state = super.getTrackerState();
HashMap<String, String> propertyBag = new HashMap<>();
propertyBag.put("coreName", coreName);
ShardState shardstate = ShardStateBuilder.shardState()
.withMaster(isMaster)
@@ -217,6 +222,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
.withTemplate(shardTemplate)
.withHasContent(transformContent)
.withShardMethod(ShardMethodEnum.getShardMethod(shardMethod))
.withPropertyBag(propertyBag)
.endFloc()
.endShard()
.endShardInstance()
@@ -337,6 +343,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
gnp.setStoreProtocol(storeRef.getProtocol());
gnp.setStoreIdentifier(storeRef.getIdentifier());
gnp.setShardProperty(shardProperty);
gnp.setCoreName(coreName);
List<Node> nodes = client.getNodes(gnp, (int) info.getUpdates());
for (Node node : nodes)
@@ -855,6 +862,7 @@ public class MetadataTracker extends AbstractTracker implements Tracker
gnp.setStoreProtocol(storeRef.getProtocol());
gnp.setStoreIdentifier(storeRef.getIdentifier());
gnp.setShardProperty(shardProperty);
gnp.setCoreName(coreName);
List<Node> nodes = client.getNodes(gnp, Integer.MAX_VALUE);
ArrayList<Node> nodeBatch = new ArrayList<>();

View File

@@ -49,9 +49,10 @@ public class GetNodesParameters
private Set<QName> includeAspects;
private Set<QName> excludeAspects;
private QName shardProperty;
private QName shardProperty;
private String coreName;
public boolean getStoreFilter()
{
return (storeProtocol != null || storeIdentifier != null);
@@ -156,6 +157,14 @@ public class GetNodesParameters
{
this.shardProperty = shardProperty;
}
public String getCoreName() {
return this.coreName;
}
public void setCoreName(String coreName){
this.coreName = coreName;
}
}

View File

@@ -610,6 +610,11 @@ public class SOLRAPIClient
{
body.put("shardProperty", parameters.getShardProperty().toString());
}
if (parameters.getCoreName() != null){
body.put("coreName", parameters.getCoreName());
}
PostRequest req = new PostRequest(url.toString(), body.toString(), "application/json");