jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: How can I filter a sql query by file type?
Date Mon, 05 Feb 2007 08:11:46 GMT
Alexandre Martins wrote:
> I need retrive nodes that contains some text and are of a specific file
> types.
> 
> "SELECT * FROM nt:base WHERE CONTAINS(.,'" + pTextQuery + "') AND jcr:path
> LIKE '%/%.pdf/%' order by jcr:score DESC";

Matching of paths in JSR 170 is limited to only a few simple use cases. What you 
basically can do is search in a sub-tree: jcr:path LIKE '/foo/bar/%'.

If you have more complex needs you should use XPath, which allows you to filter 
on every path segment.

> i´m using the query (below) normaly to retrieve files indexed by some text.
> 
> "SELECT * FROM nt:base WHERE CONTAINS(.,'" + pTextQuery + "')  order by
> jcr:score DESC";

As of jackrabbit 1.2.1 you can use the following query:

//element(*, nt:file)[jcr:contains(jcr:content, 'your query') and 
jcr:content/@jcr:mimeType = 'application/pdf']

regards
  marcel

Mime
View raw message