code: public Response search(Session session, HierarchicalProperty body, String baseURI)
     {
        try
        {
           SearchRequestEntity requestEntity = new SearchRequestEntity(body);
  
           Query query =
              session.getWorkspace().getQueryManager().createQuery(requestEntity.getQuery(),
                 requestEntity.getQueryLanguage());
           QueryResult queryResult = query.execute();
  
           WebDavNamespaceContext nsContext = new WebDavNamespaceContext(session);
           SearchResultResponseEntity searchResult = new SearchResultResponseEntity(queryResult, nsContext, baseURI);
  
           return Response.status(HTTPStatus.MULTISTATUS).entity(searchResult).build();
        }
        catch (PathNotFoundException exc)
        {
           return Response.status(HTTPStatus.NOT_FOUND).entity(exc.getMessage()).build();
  
        }
        catch (UnsupportedQueryException exc)
        {
           return Response.status(HTTPStatus.BAD_REQUEST).entity(exc.getMessage()).build();
  
        }
        catch (Exception exc)
        {
           LOG.error(exc.getMessage(), exc);
           return Response.serverError().entity(exc.getMessage()).build();
        }
  
     }
docs: Webdav search method implementation.
  
  @param session current session
  @param body rrequest body
  @param baseURI base uri
  @return the instance of javax.ws.rs.core.Response