You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by rainer <Ra...@gmx.de> on 2007/01/02 21:31:14 UTC

Re: ORDER BY clause in XPath Query using Magnolia

can u tell me why this has no effect? 
the query is being accepted, but the resultset has exactly the same order as
before...
just like i woulndt have ordered by ... 

i checked both ways u told me... and i prayed a little ;) but it didnt
help...

Maybe i have to change the syntax? or sth. like that
so if so. knows why the order by doesnt work plz tell me, thx in advance!

i tried those queries:
"//*[@jcr:primaryType='mgnl:hierarchyNode']/*/*[jcr:contains(., 'foooooo')]
order by @modificationDate"
"//*[@jcr:primaryType='mgnl:hierarchyNode']/*/*[jcr:contains(., 'foooooo')]
order by @jcr:score"

--> no effect - and no exception



Marcel Reutegger wrote:
> 
> 
>> 
>> //*[@jcr:primaryType='mgnl:hierarchyNode']/*/*[jcr:contains(.,
>> 'foooooo')]
> 
> to get the nodes ordered by modification date append:
> 
> order by @modificationDate
> 
> to get the nodes by relevance:
> 
> order by @jcr:score
> 
> regards
>   marcel
> 
> 

-- 
View this message in context: http://www.nabble.com/ORDER-BY-clause-in-XPath-Query-using-Magnolia-tf2818077.html#a8130167
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: ORDER BY clause in XPath Query using Magnolia

Posted by Marcel Reutegger <ma...@gmx.net>.
rainer wrote:
> at first thanks for your reply...
> 
> i figured out, that "order by @modificationDate" has to be replaced by
> "order by @lastmodified" - then the order in the resultSet changes ... but
> the annoying thing is, that the order is just different, but not the one i
> expected...

What's the property type of @lastmodified? If it is a String representation of a 
date and the lexicographical order of the representation does not match the 
natural order of dates you may get confusing results.

> i wrote a method that does the order manually by
> *.getMetaData().getModificationDate();

??? This does not seem to be a method of the JCR API nor Jackrabbit.

> and i expected that the result would be the same now, but it isnt... :(
> 
> Maybe "lastmodified" is not the same like "modificationDate" - i thought it
> would be the same data...
> if u know more then me ... thx ;)

Maybe someone on the magnolia list can help you here? I've no idea where those 
properties belong to.

> another question @jcr:score:
> 
> Does anybody know, whether the magnolia search supports jcr:score?
> I checked some source examples that use jcr-QueryManager and some methods
> are not implemented in magnolia-QueryManager (or was it in QueryResult?!)
> e.g. there is only getContent() that gives me a Collection! But there is no
> getNodes() that gives me an iterator... i dont know whether i try something
> - that cant work without to write the whole search myself ;-)

This rather seems to be a magnolia question.

regards
  marcel

Re: ORDER BY clause in XPath Query using Magnolia

Posted by rainer <Ra...@gmx.de>.
at first thanks for your reply...

i figured out, that "order by @modificationDate" has to be replaced by
"order by @lastmodified" - then the order in the resultSet changes ... but
the annoying thing is, that the order is just different, but not the one i
expected...

i wrote a method that does the order manually by
*.getMetaData().getModificationDate();

and i expected that the result would be the same now, but it isnt... :(

Maybe "lastmodified" is not the same like "modificationDate" - i thought it
would be the same data...
if u know more then me ... thx ;)


another question @jcr:score:

Does anybody know, whether the magnolia search supports jcr:score?
I checked some source examples that use jcr-QueryManager and some methods
are not implemented in magnolia-QueryManager (or was it in QueryResult?!)
e.g. there is only getContent() that gives me a Collection! But there is no
getNodes() that gives me an iterator... i dont know whether i try something
- that cant work without to write the whole search myself ;-)

thx...


Marcel Reutegger wrote:
> 
> Are you sure the property name is correct? Please also check the case of 
> characters. Do the nodes returned by the query actually have a property 
> modificationDate?
> 
> The query will not fail even if the property is spelled incorrectly or not 
> present because it may be a residual property or optional.
> 
> regards
> marcel
> 
-- 
View this message in context: http://www.nabble.com/ORDER-BY-clause-in-XPath-Query-using-Magnolia-tf2818077.html#a8145977
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: ORDER BY clause in XPath Query using Magnolia

Posted by Marcel Reutegger <ma...@gmx.net>.
Are you sure the property name is correct? Please also check the case of 
characters. Do the nodes returned by the query actually have a property 
modificationDate?

The query will not fail even if the property is spelled incorrectly or not 
present because it may be a residual property or optional.

regards
  marcel

rainer wrote:
> can u tell me why this has no effect? 
> the query is being accepted, but the resultset has exactly the same order as
> before...
> just like i woulndt have ordered by ... 
> 
> i checked both ways u told me... and i prayed a little ;) but it didnt
> help...
> 
> Maybe i have to change the syntax? or sth. like that
> so if so. knows why the order by doesnt work plz tell me, thx in advance!
> 
> i tried those queries:
> "//*[@jcr:primaryType='mgnl:hierarchyNode']/*/*[jcr:contains(., 'foooooo')]
> order by @modificationDate"
> "//*[@jcr:primaryType='mgnl:hierarchyNode']/*/*[jcr:contains(., 'foooooo')]
> order by @jcr:score"