You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "Martin, Tammy (US SSA)" <ta...@baesystems.com> on 2005/07/21 04:43:55 UTC

DASL Search for files with a particular file extension

Hi all,

I am trying to write a DASL Search query to search for files on the
server with a particular file extension. I am able to search for content
like the example at http://wiki.apache.org/jakarta-slide/DASLSearch .

However, when I try to modify this query to find a file extension the
query does not work.  Here is one of the versions of the query:

String path = webdavStorageAreaPath;
String fileExtQuery =
                "<D:searchrequest xmlns:D =\"DAV:\">" +
                "<D:basicsearch>" +
                "<D:select>" +
                "<D:prop>" +
                "<D:getcontentlength/>" +
                "</D:prop>" +
                "</D:select>" +
                "<D:from>" +
                "<D:scope>" +
                "<D:href>" + path + "</D:href>" +
                "<D:depth>infinity</D:depth>" +
                "</D:scope>" +
                "</D:from>" +
                "<D:where>" +
                 "<D:eq>" + "<D:prop>" + "<D:displayname/>" +
"</D:prop>" +
               "<D:literal>" + "*.txt" + "</D:literal>" + "</D:eq>" +
                "</D:where>" +
                "</D:basicsearch>" +
                "</D:searchrequest>";

Does anyone know how to set up a query for all files with a certain
extension?  Also where is the documentation for what properties are
available and how or can wildcards be used?  Any help that you could
provide would be greatly appreciated.

Thanks,
Tammy


Re: DASL Search for files with a particular file extension

Posted by Guido Casper <gc...@s-und-n.de>.
Martin, Tammy (US SSA) wrote:
> Hi all,
> 
> I am trying to write a DASL Search query to search for files on the
> server with a particular file extension. I am able to search for content
> like the example at http://wiki.apache.org/jakarta-slide/DASLSearch .
> 
> However, when I try to modify this query to find a file extension the
> query does not work.  Here is one of the versions of the query:
> 
> String path = webdavStorageAreaPath;
> String fileExtQuery =
>                 "<D:searchrequest xmlns:D =\"DAV:\">" +
>                 "<D:basicsearch>" +
>                 "<D:select>" +
>                 "<D:prop>" +
>                 "<D:getcontentlength/>" +
>                 "</D:prop>" +
>                 "</D:select>" +
>                 "<D:from>" +
>                 "<D:scope>" +
>                 "<D:href>" + path + "</D:href>" +
>                 "<D:depth>infinity</D:depth>" +
>                 "</D:scope>" +
>                 "</D:from>" +
>                 "<D:where>" +
>                  "<D:eq>" + "<D:prop>" + "<D:displayname/>" +
> "</D:prop>" +
>                "<D:literal>" + "*.txt" + "</D:literal>" + "</D:eq>" +
>                 "</D:where>" +
>                 "</D:basicsearch>" +
>                 "</D:searchrequest>";
> 
> Does anyone know how to set up a query for all files with a certain
> extension?  Also where is the documentation for what properties are
> available and how or can wildcards be used?  Any help that you could
> provide would be greatly appreciated.

The DASL spec defines a like operator:
http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-07.html#rfc.section.5.15

which however is not supported by Slide. You may want to use Slide's 
proprietary:
<D:where>
   <SLIDE:propcontains xmlns:SLIDE="http://jakarta.apache.org/slide/">
     <D:prop><D:displayname/></D:prop>
     <D:literal>.txt</D:literal>
   </SLIDE:propcontains>
</D:where>

HTH
Guido

-- 
Freundliche Grüße / With kind regards
Guido Casper

S&N AG
Competence Center Open Source
Klingenderstr. 5
D 33100 Paderborn

voice  +49 5251/1581-87
fax    +49 5251/1581-71
eMail  gcasper@s-und-n.de
Web    http://www.s-und-n.de

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org