Re: Jackrabbit/SQL query

2007-03-28 Thread Brian Thompson

Thanks for the hints, Shaun.  I'll take another look at the spec.

My repository has the following structure:

/sites
/sites/mySite
/sites/mySite/rootFolder
/sites/mySite/rootFolder/folder1
/sites/mySite/rootFolder/folder1/file1

etc.

where rootFolder is the root of a folder structure for storing files in 
the repository, separated by site.


My goal is search for files within one site but not another, e.g. SELECT 
* FROM my:type WHERE (site = 'mySite').  Using something like what 
you've described should be quite helpful.


Thanks again,

-Brian



Shaun Barriball wrote:

Hi Brian,
We use the following:
"SELECT * FROM my:type WHERE jcr:path LIKE '" + rootPath + "'"
Where rootPath is a variable containing wildcards say "/home/%".

Your query implies your intention may be to look for instances of the type
ANYWHERE in the tree where the exist in a certain named folder e.g. "foo"
where you may have:
/foo
/bar/foo
/bar/bar/foo

If so then the query above may be inappropriate as I'm not sure you can use
wildcards 'within' the path e.g. "/%/home/%". I suggest referring to the
"Path Constraint" section (6.6.3.4) in the spec.

Regards,
Shaun.

-Original Message-
From: Brian Thompson [mailto:[EMAIL PROTECTED] 
Sent: 27 March 2007 21:58

To: [email protected]
Subject: Jackrabbit/SQL query

Inspired by
http://diningtablecoder.blogspot.com/2006/11/using-lucene-syntax-in-jackrabb
it-sql.html,
I'm trying to write a query that only searches for nodes of a certain type
within a particular subtree in my repository.  Unfortunately, the following
query (my first attempt) returns no results:

SELECT * FROM my:type WHERE contains(jcr:path, '"nodeName"')


Note that the characters around nodeName are a single quote, then a double
quote on the left and a double quote, then a single quote on the right.

Does anyone have an idea of what I'm doing wrong?

Thanks,

-Brian



___ 
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html




RE: Jackrabbit/SQL query

2007-03-27 Thread Shaun Barriball
Hi Brian,
We use the following:
"SELECT * FROM my:type WHERE jcr:path LIKE '" + rootPath + "'"
Where rootPath is a variable containing wildcards say "/home/%".

Your query implies your intention may be to look for instances of the type
ANYWHERE in the tree where the exist in a certain named folder e.g. "foo"
where you may have:
/foo
/bar/foo
/bar/bar/foo

If so then the query above may be inappropriate as I'm not sure you can use
wildcards 'within' the path e.g. "/%/home/%". I suggest referring to the
"Path Constraint" section (6.6.3.4) in the spec.

Regards,
Shaun.

-Original Message-
From: Brian Thompson [mailto:[EMAIL PROTECTED] 
Sent: 27 March 2007 21:58
To: [email protected]
Subject: Jackrabbit/SQL query

Inspired by
http://diningtablecoder.blogspot.com/2006/11/using-lucene-syntax-in-jackrabb
it-sql.html,
I'm trying to write a query that only searches for nodes of a certain type
within a particular subtree in my repository.  Unfortunately, the following
query (my first attempt) returns no results:

SELECT * FROM my:type WHERE contains(jcr:path, '"nodeName"')


Note that the characters around nodeName are a single quote, then a double
quote on the left and a double quote, then a single quote on the right.

Does anyone have an idea of what I'm doing wrong?

Thanks,

-Brian



___ 
The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html