thomasmueller commented on code in PR #2145:
URL: https://github.com/apache/jackrabbit-oak/pull/2145#discussion_r1984864399
##########
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:
You are right... I originally used slash, but then found out that this is
not allowed because we need to support functions, and those can contain `/`...
--
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]