isLanguage = false;
language = null;
dataTypePrefix = null;
}
// now parse the indexDataType!
IndexDataTypeEnum dataTypeEnumEntry = IndexDataTypeEnum.forPrefixSuffix(dataTypePrefix, suffix);
if (dataTypeEnumEntry == null) {
log.warn(String.format(
"No IndexDataType registered for prefix: %s and suffix: %s -> unable to process path %s",
dataTypePrefix, suffix, Arrays.toString(pathElements)));
return null; // we might also throw an exception at this point
}
// parse the path
List<String> path = new ArrayList<String>(pathElements.length);
for (String pathElement : pathElements) {
if (pathElement.charAt(0) == SolrConst.SPECIAL_FIELD_PREFIX) {
if (pathElement.charAt(1) == SolrConst.SPECIAL_FIELD_PREFIX) {
path.add(getFullFieldName(pathElement.substring(1)));
} else {
throw new IllegalStateException(
String.format(
"Found special field \"%s\" within the path \"%s\" -> Special fields are only allowed as prefix and suffix!",
pathElement, Arrays.toString(pathElements)));
}
} else {
String fullName = getFullFieldName(pathElement);
if (fullName == null) {
throw new IllegalStateException(String.format(
"Unable to map PathElement %s to it's full Name (path=%s)!", pathElement,
Arrays.toString(pathElements)));
} else {
path.add(fullName);
}
}
}
if (isLanguage) {
return new IndexField(path, dataTypeEnumEntry.getIndexType(), language);
} else {
return new IndexField(path, dataTypeEnumEntry.getIndexType());
}
}