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 Jagadeesh Sunkara <js...@baan.com> on 2004/11/08 20:38:18 UTC

Basic Search Problem in Slide 2.1 Beta2

Hello,
I've been trying to do a very basic search like searching for filenames
containing "xyz" under /files/folder1 and its subfolders. I've followed the
code and search query examples from the mailing list. But I couldn't get the
any responseURLs back. Please help me out...
 
I guess the problem is in the "scope" path or/and search path or may be in
the search query. Its not quite clear to me, how to pass the values for
scope and search path if 
 
my slide server is running on http://localhost:8080/slide
<http://localhost:8080/slide>       (slide 2.1 Beta2)
and i am trying to search for all files "*xyz*" under /files/folder1
 
Here is the code snippet....
 
HttpURL hrl = new HttpURL( <http://localhost:8080/slide/>
http://localhost:8080/slide/);
hrl.setUserinfo("root","root");
String sQuery = ...see the following...
--------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<d:searchrequest xmlns:d="DAV:">
 <d:basicsearch>
  <d:select>
   <d:prop>
    <d:displayname/>
   </d:prop>
  </d:select>
  <d:from>
   <d:scope>
    <d:href>files/folder1</d:href>
   </d:scope>
  </d:from>
  <d:where>
   <slide:propcontains xmlns:slide="http://jakarta.apache.org/slide/
<http://jakarta.apache.org/slide/> ">
    <d:prop>
     <d:displayname/>
    </d:prop>
    <d:literal>xyz</d:literal>
   </slide:propcontains>
  </d:where>
 </d:basicsearch>
</d:searchrequest>
--------------------------------------------
   SearchMethod smethod = new SearchMethod("/", sQuery);
   smethod.setDebug(7);
   HttpClient client = new HttpClient();
   client.setState(new WebdavState());
   client.getHostConfiguration().setHost(hrl);
   int iState = client.executeMethod(smethod);
   m_oLogger.log(smethod.getResponseBodyAsString());
   Enumeration enum = smethod.getAllResponseURLs();
   while (enum.hasMoreElements())
    m_oLogger.log((String)enum.nextElement());  

 
Thanks,
Jagadeesh

Re: Basic Search Problem in Slide 2.1 Beta2

Posted by Stefan Lützkendorf <lu...@apache.org>.
Hi Jagadeesh,
you are right, the problem is that the request path and the scope href 
don't fit together

The relative scope href is resolved relative to the request uri. Try
   SearchMethod smethod = new SearchMethod("/slide", sQuery);

An other option may be using an absolute scope
  <d:scope>
   <d:href>/slide/files/folder1</d:href>
  </d:scope>

Stefan

Jagadeesh Sunkara wrote:
> Hello,
> I've been trying to do a very basic search like searching for filenames
> containing "xyz" under /files/folder1 and its subfolders. I've followed the
> code and search query examples from the mailing list. But I couldn't get the
> any responseURLs back. Please help me out...
>  
> I guess the problem is in the "scope" path or/and search path or may be in
> the search query. Its not quite clear to me, how to pass the values for
> scope and search path if 
>  
> my slide server is running on http://localhost:8080/slide
> <http://localhost:8080/slide>       (slide 2.1 Beta2)
> and i am trying to search for all files "*xyz*" under /files/folder1
>  
> Here is the code snippet....
>  
> HttpURL hrl = new HttpURL( <http://localhost:8080/slide/>
> http://localhost:8080/slide/);
> hrl.setUserinfo("root","root");
> String sQuery = ...see the following...
> --------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <d:searchrequest xmlns:d="DAV:">
>  <d:basicsearch>
>   <d:select>
>    <d:prop>
>     <d:displayname/>
>    </d:prop>
>   </d:select>
>   <d:from>
>    <d:scope>
>     <d:href>files/folder1</d:href>
>    </d:scope>
>   </d:from>
>   <d:where>
>    <slide:propcontains xmlns:slide="http://jakarta.apache.org/slide/
> <http://jakarta.apache.org/slide/> ">
>     <d:prop>
>      <d:displayname/>
>     </d:prop>
>     <d:literal>xyz</d:literal>
>    </slide:propcontains>
>   </d:where>
>  </d:basicsearch>
> </d:searchrequest>
> --------------------------------------------
>    SearchMethod smethod = new SearchMethod("/", sQuery);
>    smethod.setDebug(7);
>    HttpClient client = new HttpClient();
>    client.setState(new WebdavState());
>    client.getHostConfiguration().setHost(hrl);
>    int iState = client.executeMethod(smethod);
>    m_oLogger.log(smethod.getResponseBodyAsString());
>    Enumeration enum = smethod.getAllResponseURLs();
>    while (enum.hasMoreElements())
>     m_oLogger.log((String)enum.nextElement());  
> 
>  
> Thanks,
> Jagadeesh
> 

-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org


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