jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Lombart <christophe.lomb...@gmail.com>
Subject Re: How to Filter on a Collection
Date Tue, 18 Aug 2009 10:29:22 GMT
Hi Kristof,

Sorry for the delay.

The OCM query manager is not yet supporting queries with collection
element properties but you can search content objects with a native
JCR query (see ObjectContentManager.getObjects(String query, String
language) or ObjectContentManager.getObjectIterator(String query,
String language)).

I'm just wondering if you can use the following JCR statement (or
something similar) :
//element(*, nt:unstructured) [@code='code1' and meta/*/@lang= 'FR'  ]


2009/8/15 Kristof Taveirne <kristof.taveirne@gmail.com>:
> Hi,
> I'm just starting out using jackrabbit and I'm running into something that's
> probably a newbie question but anyway here I go.
> I'm using OCM and I have this class which represents some content.
> The content also has some metadata which is stored in List of MetaData
> objects.
> MetaData object is a Key/Value pair.
> This list is annotated with the @Collection annotation.
> I want to search this content based on some properties but then I want to
> select the apropriate version of the content.
> For example "Show content about X but with language="ENGLISH" AND
> childproof=true"
> This would return English content with images that is OK to show to
> children.
> language and childproof are NOT fields in the Content object but are keys in
> MetaData objects.
> Here is the structure of my class
> Content
>  - code
>  - title
>  - subtitle
>  - text
>  - image
>  - meta
>    - metaData ( key: lang, value: "EN")
>    - metaData ( key: childproof, value: "true")
> code represents an identifier for the content. this means the dutch version
> and the english version have the same code.
> I know the code, and I want to filter out the childproof english version.
> filter.addEqualTo("code","1F3CDX4") ... that was easy
> I would like to do the query on repository level, but ofcourse I could just
> fetch all Content objects with that code, and filter manually ....
> Can somebody help me with this?
> Thanks!
> Greetings,
> K.

View raw message