jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Search with the SQL language and conditions
Date Tue, 22 Aug 2006 12:08:42 GMT
Expressions on the pseudo property jcr:path are very limited and will 
in general only work in a reasonable way when you limit the nodes to a 
certain subtree of the workspace.

e.g. jcr:path like '/foo/bar/%'

XPath might do the job:

//element(oliver, nt:file)

will return all nt:file nodes named 'oliver'.

Jackrabbit also puts the node name into the fulltext index, which 
means you could to this:

select * from nt:file where contains(*,'oliver')

or

//element(*, nt:file)[jcr:contains(*,'oliver')]

regards
  marcel

olivier wrote:
> Hi, 
> I would search files in the repository. I use SQL language.
> Here my code : 
> String keywords = "olivier";
> String querySQL = "SELECT * FROM " + "nt:file" +" WHERE jcr:path Like '%" + keywords
+ "%'"; 
> QueryManager queryManager = session.getWorkspace().getQueryManager();
> Query query = queryManager.createQuery(querySQL,"sql");
> QueryResult queryResult = query.execute();
> System.out.println("noombre de resultats : " + queryResult.getRows().getSize());
> I obtain no error, but no results. When i delete the condition "where...", I recover
all the files.
> Why don't it function with the condition "where..."? 
> Somebody can he help me?
> Olivier


Mime
View raw message