On 10.08.2011, at 12:04, Jukka Zitting wrote:
> Hi,
>
> On Wed, Aug 10, 2011 at 11:46 AM, Lukas Kahwe Smith <[email protected]>
> wrote:
>> I explained the use case in my original post. What I need to do is to
>> get the last X days within /issues sorted decending by date
>
> I was rather interested in the reason why you need the list of last X
> days, i.e. what value does some client of your application get from
> this information? A more typical query for an issue tracker system
> (which I assume you're building) would be to ask for the last X
> issues.
Ah. the use case is allowing users to select one of the last X newspaper issues
available. issue means newspaper here :)
> Anyway, assuming the date nodes really are needed for more than just
> organizing the underlying issue nodes, I'd recommend labeling them
> with their own node types and adding relevant information like the
> date as properties of those nodes. Parsing information from the path
> (like in this case the date) can lead to unnecessarily complex code
> like we're seeing here.
>
> With such a node type, you should be able to get the last X days with
> the following query and a limit of just X results:
>
> SELECT * FROM [my:day] WHERE ISDESCENDANTNODE('/issues') ORDER BY date DESC
Well I would still need to "denormalize" the date which is already part of the
path, but I would spare myself having to also store the depth if I would use a
node type.
But I wasnt aware I could use ISDESCENDANTNODE() like this, thx!
So to summarize I would still like to see PATH() (so that I can sort on that)
and DEPTH() (so that for this use case I would not need a custom node type)
implemented :)
regards,
Lukas Kahwe Smith
[email protected]