You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (Jira)" <ji...@apache.org> on 2020/10/14 14:18:00 UTC

[jira] [Commented] (OAK-9252) Query: multi-valued property condition can fail with "Type must be an array type"

    [ https://issues.apache.org/jira/browse/OAK-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213946#comment-17213946 ] 

Thomas Mueller commented on OAK-9252:
-------------------------------------

https://github.com/oak-indexing/jackrabbit-oak/pull/323

> Query: multi-valued property condition can fail with "Type must be an array type"
> ---------------------------------------------------------------------------------
>
>                 Key: OAK-9252
>                 URL: https://issues.apache.org/jira/browse/OAK-9252
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Major
>
> A condition of the form "property = 'literal'" can fail with the error messageĀ "Type must be an array type" if:
>  * the property is multi-value and has no entries (count 0)
>  * the property type is not String (e.g. Name)
> Example query:
> {noformat}
> select * from [nt:base]
> where isdescendantnode('/etc') 
> and [jcr:mixinTypes] = 'mix:referenceable' 
> {noformat}
> This can fail if there is no index for this (e.g. by disabling the nodetype index), and if there is a node with an empty mixin type. Test case (org.apache.jackrabbit.oak.jcr.query.QueryTest):
> {noformat}
>     @Test
>     public void emptyMixin() throws RepositoryException {
>         Session session = createAdminSession();
>         Node p = session.getRootNode().addNode("etc");
>         Node r = p.addNode("r", "nt:unstructured");
>         r.addMixin("mix:referenceable");
>         session.save();
>         r.removeMixin("mix:referenceable");
>         session.save();
>         assertTrue(r.hasProperty("jcr:mixinTypes"));
>         Property mix = r.getProperty("jcr:mixinTypes");
>         assertTrue(mix.isMultiple());
>         assertEquals(0, mix.getValues().length);
>         session.save();
>         Query q = session.getWorkspace().getQueryManager().createQuery(
>                 "select * from [nt:base] where isdescendantnode('/etc') " +
>                 "and [jcr:mixinTypes] = 'mix:referenceable' " +
>                 "option(index name [x])", Query.JCR_SQL2);
>         QueryResult qr = q.execute();
>         NodeIterator ni = qr.getNodes();
>         assertFalse(ni.hasNext());
>         session.logout();
>     }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)