return null; // no need to recurse down the removed subtree
}
private SolrInputDocument docFromState(NodeState state) {
SolrInputDocument inputDocument = new SolrInputDocument();
String path = getPath();
if (!path.endsWith("/")) {
path = path + "/";
}
inputDocument.addField(configuration.getPathField(), path);
for (PropertyState property : state.getProperties()) {
// try to get the field to use for this property from configuration
String fieldName = configuration.getFieldNameFor(property.getType());
if (fieldName != null) {
inputDocument.addField(
fieldName, property.getValue(property.getType()));
} else {
// or fallback to adding propertyName:stringValue(s)
if (property.isArray()) {
for (String s : property.getValue(Type.STRINGS)) {
inputDocument.addField(property.getName(), s);
}
} else {
inputDocument.addField(
property.getName(), property.getValue(Type.STRING));
}
}
}
return inputDocument;