jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: xpath aggregation question
Date Wed, 04 Oct 2006 13:13:40 GMT
Hi,

On 10/4/06, Shane Preater <shane.preater@googlemail.com> wrote:
> I am trying to return the distinct brand property on a series of nodes and
> have no idea how to go about it. Any help would be fantastic.
>
> for example:
> /categories//products/*   will return all my products
> all the nodes returned have a brand property so:
>
> /categories//products/*/@brand  will return all the brands
>
> but how make the list distinct? Or will I need to use an SQL query instead?

Again, I'm sorry to say that the query features in JSR 170 won't help
you there. There is no support for aggregate results, joins, or other
advanced query features, so you'll essentially need to work around the
limitation by post-processing the query results.

But again there is an alternative where you setup separate
referenceable brand nodes like /categories/brands/* and turn the
@brand property of a product node into a reference. Then you can list
all your brands by listing the children of /categories/brands and you
will also have a very efficient way to retrieve all the products of a
given brand.

BR,

Jukka Zitting

-- 
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development

Mime
View raw message