jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukas Kahwe Smith <...@pooteeweet.org>
Subject Re: SQL2 (via davex)
Date Tue, 09 Aug 2011 21:32:26 GMT

On 09.08.2011, at 23:28, Mark Herman wrote:

> I'm just learning myself so I figured I'd take a crack at it.  It appears
> that PATH() isn't implemented, so I went more along the lines of your 2nd

yeah its odd that PATH) isnt implemented, but more importantly why can't I even index jcr:path?

> approach.  I'm able to get a list of all the dates and able to filter by
> date, but not sure how to filter by length of name considering I only know
> how to get the name by dynamic operands, and I can't nest it inside the
> length operand.
> 
> This gets me all the dates:
> SELECT days.* FROM [nt:unstructured] AS issues 
> 	INNER JOIN [nt: unstructured] AS years ON ISCHILDNODE(years,issues) 
> 	INNER JOIN [nt:unstructured] AS months ON ISCHILDNODE(months,years) 
> 	INNER JOIN [nt:unstructured] AS days ON ISCHILDNODE(days,months)
> 	WHERE NAME(issues) = 'issues'
> 
> Easy enough to filter on a day:
> SELECT days.* FROM [nt:unstructured] AS issues 
> 	INNER JOIN [nt: unstructured] AS years ON ISCHILDNODE(years,issues) 
> 	INNER JOIN [nt:unstructured] AS months ON ISCHILDNODE(months,years) 
> 	INNER JOIN [nt:unstructured] AS days ON ISCHILDNODE(days,months) 
> 	WHERE NAME(issues) = 'issues'  
> 		AND NAME(months) =  '08'  
> 
> What I would like to do is:
> SELECT days.* FROM [nt:unstructured] AS issues 
> 	INNER JOIN [nt: unstructured] AS years ON ISCHILDNODE(years,issues) 
> 	INNER JOIN [nt:unstructured] AS months ON ISCHILDNODE(months,years) 
> 	INNER JOIN [nt:unstructured] AS days ON ISCHILDNODE(days,months) 
> 	WHERE NAME(issues) = 'issues'  
> 		AND LENGTH(NAME(years)) =  4
> 		AND LENGTH(NAME(months)) =  2  
> 		AND LENGTH(NAME(days)) =  2  
> 
> But that failed. From what I can tell the grammar doesn't allow nested
> dynamic operands.

ok .. i will play with that some more.

> Depends on your use case, but it might just be easier to put a property on
> your days (or create a new node type) and just search for that.  Alternately
> you could go by a property on your "foo" and "bar" and join with the parent.


yeah .. i did that in the end .. but now i am stuck trying to figure out how to sort things
.. again i would love to sort by path, but alas i will probably have to add yet another field
to be able to sort on.

regards,
Lukas Kahwe Smith
mls@pooteeweet.org




Mime
View raw message