chibulcu commented on code in PR #2145:
URL: https://github.com/apache/jackrabbit-oak/pull/2145#discussion_r1984699792
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/util/ElasticIndexUtils.java:
##########
@@ -31,6 +31,31 @@ public class ElasticIndexUtils {
private static final Logger LOG =
LoggerFactory.getLogger(ElasticIndexUtils.class);
+ /**
+ * Convert a JCR property name to a Elasticsearch field name.
+ * Notice that "|" is not allowed in JCR names.
+ *
+ * "." is converted to "|dot|"
+ * "/" is converted to "||"
+ *
+ * @param propertyName the property name
+ * @return the field name
+ */
+ public static String fieldName(String propertyName) {
+ String fieldName = propertyName;
+ // 99% property names don't contain a slash or dot,
+ // so for performance reason use indexOf
+ int slashIndex = fieldName.indexOf('|');
+ if (slashIndex >= 0) {
+ fieldName = fieldName.replaceAll("\\|", "\\|\\|");
Review Comment:
shouldn't this be `\\/` (slash) instead of `\\|`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]