You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Dupont, Stephane" <St...@getronics.com> on 2005/02/28 18:20:45 UTC

Querying doesn't work !

Hi,

I would like to make a simple search that return me all nodes which have
the nt:unstructured primaryType, but the result is always empty :

    QueryManager qm = session.getWorkspace().getQueryManager();
    Query query = qm.createQuery("SELECT * FROM nt:unstructured",
Query.SQL);
    QueryResult result = query.execute();

My content (dump of the root node) :
    /
    /jcr:primaryType=rep:root
    /jcr:system
    /jcr:system/jcr:primaryType=rep:system
    /jcr:system/jcr:versionStorage
    /jcr:system/jcr:versionStorage/jcr:primaryType=rep:versionStorage
    /jcr:system/jcr:versionStorage/jcr:mixinTypes=
    /MyRootNode
    /MyRootNode/jcr:primaryType=nt:unstructured

--> The result is empty.

I tried also with nt: base ("SELECT * FROM nt:base"), but
unsuccessfully.
Idem when i specify a XPath query : //MyRootNode or /MyRootNode

But initially, the query was something like this :
"SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/MyRootNode'"

What's wrong ? Any idea ?

Thanks
Stephane

PS : i use the latest svn checkout (this morning).

Re: Querying doesn't work !

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Stephane,

All the queries work on my checkout. Are you using old index data with 
the newly checkout code. because jackrabbit is not yet final, there 
might be changes in the code that are not compatible with the index data 
from previous changes.

did you try to delete the index and then start jackrabbit? This will 
recreate the index.

If that does not help, could you please create a jira bug and attach the 
workspace directory (the one with the workspace.xml in it)?
http://issues.apache.org/jira/browse/JCR
thanks

btw. the XPath query /MyRootNode will never return any results because 
the root node of the virtual xml document is always a jcr:root element.
see also: public final draft jcr spec section 6.6.3.3

cheers
  marcel

Dupont, Stephane wrote:
> Hi,
> 
> I would like to make a simple search that return me all nodes which have
> the nt:unstructured primaryType, but the result is always empty :
> 
>     QueryManager qm = session.getWorkspace().getQueryManager();
>     Query query = qm.createQuery("SELECT * FROM nt:unstructured",
> Query.SQL);
>     QueryResult result = query.execute();
> 
> My content (dump of the root node) :
>     /
>     /jcr:primaryType=rep:root
>     /jcr:system
>     /jcr:system/jcr:primaryType=rep:system
>     /jcr:system/jcr:versionStorage
>     /jcr:system/jcr:versionStorage/jcr:primaryType=rep:versionStorage
>     /jcr:system/jcr:versionStorage/jcr:mixinTypes=
>     /MyRootNode
>     /MyRootNode/jcr:primaryType=nt:unstructured
> 
> --> The result is empty.
> 
> I tried also with nt: base ("SELECT * FROM nt:base"), but
> unsuccessfully.
> Idem when i specify a XPath query : //MyRootNode or /MyRootNode
> 
> But initially, the query was something like this :
> "SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/MyRootNode'"
> 
> What's wrong ? Any idea ?
> 
> Thanks
> Stephane
> 
> PS : i use the latest svn checkout (this morning).
> 
>