You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by 毛进 <da...@163.com> on 2011/11/22 08:33:02 UTC
Multi-value column selector problem
Hello, every one :
I want to fetch the values from a multi-valued column. I used like this :
xpathQuery.append("//element(*, resource)");
xpathQuery.append("[@type='picture'");
xpathQuery.append(" and jcr:like(@category,'/tpk/mzmjw6115/mjwjdjz6502/m%') ");
xpathQuery.append("]/(@title|@category)");///@category
xpathQuery.append(" order by @jcr:score descending");
And parse the values:
Value title= row.getValue("title");
System.out.println(title!=null?row.getValue("title").getString():"null");
Value cats = row.getValue("category");
System.out.println(cats!=null?row.getValue("category").getString():"null");
However, i can get the right "title" value. Because it is not multi-valued.
I can not get the correct "category"value, 'cause it is multi-valued.
Why???
And how can i get the multivalued property by using the feature of column selector?
Thank you all.
Re: Re: Multi-value column selector problem
Posted by 毛进 <da...@163.com>.
Thank for Alexander
I got the solution.
2011-11-23
毛进
发件人: Alexander Klimetschek
发送时间: 2011-11-22 20:43:09
收件人: users@jackrabbit.apache.org
抄送:
主题: Re: Multi-value column selector problem
On 22.11.11 08:33, "毛进" <da...@163.com> wrote:
>And how can i get the multivalued property by using the feature of column
>selector?
Use row.getNode() (since 2.0) to get the node and then normal JCR API
methods, such as node.getProperty("category").getValues() for a
multi-value node.
Or use QueryResult.getNodes() instead of getRows() right away.
Cheers,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel
Re: Multi-value column selector problem
Posted by Alexander Klimetschek <ak...@adobe.com>.
On 22.11.11 08:33, "毛进" <da...@163.com> wrote:
>And how can i get the multivalued property by using the feature of column
>selector?
Use row.getNode() (since 2.0) to get the node and then normal JCR API
methods, such as node.getProperty("category").getValues() for a
multi-value node.
Or use QueryResult.getNodes() instead of getRows() right away.
Cheers,
Alex
--
Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel