The "root" is the root directory for the App Server. It appears you are
doing the right thing, but possibly you are running some of these
queries against different databases?

I tried this and it worked (all run as a user with the admin role):

1) Created an Http Server named Tmp with root Tmp/ and database and
modules both pointed toward the same database (I used one called
"test").  I used port 8003.

2) Copied the browser.xqy code to c:/tmp/browser.xqy

3) Ran the following in cq, pointing to my App Server in the
content-source drop down list [test(Tmp)]:

xdmp:document-load(
        "c:/tmp/browser.xqy",
        <options xmlns="xdmp:document-load">
           <uri>Tmp/browser.xq</uri>
           <repair>none</repair>
           <format>text</format>
        </options>
      )

4) In cq, ran the following against the same content source:

doc("Tmp/browser.xq")

This returned the newly inserted document.

5) In cq, ran the following against the same content source:

xdmp:document-insert("Tmp/test.xml", <foo>this is a test</foo>)

This will create a document for me to see in the directory browser (it
will only find things under the root).

6) In a browser window, go to http://localhost:8003/browser.xq

The directory browser shows up.



-----Original Message-----
From: Florent Georges [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2008 9:40 AM
To: Danny Sokolsky; General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Set the Modules and Documents DB to
be thesame?

Danny Sokolsky wrote:

  Hi,

  First, many thanks for your detailed answer, Danny.

> This is an error in the doc.  That should say "HTTP Server"
> instead of "WebDAV server".

  Ah, ok.  Now I've been able to set both Modules and
Documents databases on the HTTP server.  But...

> 1. Create an HTTP Server and configure it as follows:

> a) Set the Modules database to be the same database as the
> Documents database. For example, if the database setting is
> set to the database named "my-database", set the modules
> database to "my-database" as well.

  Ok.  I've set both of them to the default-created Documents
database.

> b) Set the HTTP Server root to http://myDirectory/, or set
> the root to another value and modify the $rootdir variable
> in the directory browser code so it matches your HTTP
> Server root.

  I followed what was done for the default-created HTTP
server (Docs on 8000), and put "Tmp/" as the value of the
field "root" in the form to create a new HTTP server.  The
server name is also "Tmp".

  I am not sure what you mean with "http://myDirectory/";.  I
guess you mean to put "myDirectory" in the "root" field?

> c) Set the port to 9001, or to a port number not currently
> in use.

  Set to 8003.

> 2) Copy the sample code into a file named browser.xqy. If
> needed, modify the $rootdir variable to match your HTTP
> Server root. Using the xdmp:modules-root function, as in
> the sample code, will automatically get the value of the
> App Server root.

  ...
 
> 3) Load the browser.xqy file into the Modules database at
> the top level of the HTTP Server root. For example, if the
> HTTP Server root is http://myDirectory/, load the
> browser.xqy file into the database with the URI
> http://myDirectory/browser.xqy. You can load the document
> either via a WebDAV client (if you also have a WebDAV
> server pointed to this root) or with the xdmp:document-load
> function.

  I tried both using the "Load" tab on the database in the
admin console, and using xdmp:document-load() like this:

    xdmp:document-load(
        "x:/browser.xq",
        <options xmlns="xdmp:document-load">
           (: Tmp/ is the root of the HTTP server :)
           <uri>Tmp/browser.xq</uri>
           <repair>none</repair>
        </options>
      )

  But I am not able to get it back.  I tried both doc() and
xdmp:document-get() (with "Tmp/browser.xq".)  In both cases
the document doesn't exist.

  I evaluated this call in CQ.  Because CQ has to be
installed on the disk and the Modules database of this HTTP
server as to be a real database, CQ cannot be installed on
the same HTTP server (my CQ is installed on the default HTTP
server installed on 8000.)  I am not aware of any other
builtin way to evaluate an XQuery.

  I think I am a bit lost between the document's URIs, the
servers and the databases :-(

  Do you see something wrong?

  Best regards,

--drkm





















      
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to