使用 OR 和 LOWER() 时出现 UnsupportedRepositoryOperationException

UnsupportedRepositoryOperationException when using OR and LOWER()

我刚开始使用 JackRabbit 查询并面临这个问题。此查询在语义上是合理的,但它显示 Unsupportedxxx。删除 LOWER(),它运行没有错误。这是JackRabbit的错误吗?我该如何解决?

查询

SELECT t.*
FROM [nt:base] AS t
WHERE t.[jcr:primaryType] = 'someType'
    OR (LOWER(NAME(t)) = 'a')

例外情况

javax.jcr.UnsupportedRepositoryOperationException: null
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.getNodeNameQuery(LuceneQueryFactory.java:639) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.getComparisonQuery(LuceneQueryFactory.java:625) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.create(LuceneQueryFactory.java:430) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.addBooleanConstraint(LuceneQueryFactory.java:556) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.getOrQuery(LuceneQueryFactory.java:532) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.create(LuceneQueryFactory.java:422) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.mapConstraintToQueryAndFilter(LuceneQueryFactory.java:409) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.mapConstraintToQueryAndFilter(LuceneQueryFactory.java:361) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory.execute(LuceneQueryFactory.java:210) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:465) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:126) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.lucene.join.QueryEngine.execute(QueryEngine.java:115) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.QueryObjectModelImpl.perform(QueryObjectModelImpl.java:129) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.QueryObjectModelImpl.perform(QueryObjectModelImpl.java:124) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216) ~[jackrabbit-core-2.12.4.jar:2.12.4]
    at org.apache.jackrabbit.core.query.QueryObjectModelImpl.execute(QueryObjectModelImpl.java:123) ~[jackrabbit-core-2.12.4.jar:2.12.4]

工单提交于 https://issues.apache.org/jira/browse/JCR-4234

解决方法是使用

... OR LOWER(LOCALNAME(t)) LIKE ...