Steve Mallen | 1 Aug 17:19 2008

[MarkLogic Dev General] DELETE method not allowed on HTTP Server?

Hi folks,

I've been trying to implement a simple REST-style API using the Mark 
Logic HTTP server and an XQuery controller.  This has been going fairly 
well; but I've hit a bit of a brick wall with the DELETE method:

I have my HTTP server set up with authentication: "application-level" 
and default user: "admin", in order to effectively turn off security 
(I'm just doing some prototypying here).

When I submit a DELETE request to the server I get a "500 Internal 
Server Error" response code, with this message:

    SEC-DEFAULTUSERDNE: Default user does not exist: sec:user-id = 
7561169777825101503

GET and POST requests are working fine, by the way.  I haven't tried the 
PUT method yet.

To try and get around this, I turned security on by setting 
authentication to "basic", and sending the username and password 
credentials to the server.  I then get:

    403 Forbidden

There is no clue as to why the request has been denied.  Does this 
basically mean that the "DELETE" method isn't supported?  I tried to 
test this assumption by doing an "OPTIONS" request, which predictably 
gave me:

(Continue reading)

Michael Blakeley | 1 Aug 18:53 2008

Re: [MarkLogic Dev General] DELETE method not allowed on HTTP Server?

Steve,

The misleading error message for DELETE with application-level 
authentication is a bug, and I understand that a fix is in the works for 
a future release. As you found, switching to HTTP authentication results 
in the correct error message (405).

There is an open RFE for HTTPServer support for the DELETE method, but I 
can't speak to its implementation status. Meanwhile, support for DELETE, 
PUT, and OPTIONS can be implemented via request-rewriting. One approach 
is to create a simple Apache module, which rewrites each method to a 
POST with a method={$VERB} request-field.

-- Mike

Steve Mallen wrote:
> Hi folks,
> 
> I've been trying to implement a simple REST-style API using the Mark 
> Logic HTTP server and an XQuery controller.  This has been going fairly 
> well; but I've hit a bit of a brick wall with the DELETE method:
> 
> I have my HTTP server set up with authentication: "application-level" 
> and default user: "admin", in order to effectively turn off security 
> (I'm just doing some prototypying here).
> 
> When I submit a DELETE request to the server I get a "500 Internal 
> Server Error" response code, with this message:
> 
>     SEC-DEFAULTUSERDNE: Default user does not exist: sec:user-id = 
(Continue reading)

James A. Robinson | 2 Aug 01:17 2008
Picon

Re: [MarkLogic Dev General] DELETE method not allowed on HTTP Server?


> There is an open RFE for HTTPServer support for the DELETE method, but I 
> can't speak to its implementation status. Meanwhile, support for DELETE, 
> PUT, and OPTIONS can be implemented via request-rewriting. One approach 
> is to create a simple Apache module, which rewrites each method to a 
> POST with a method={$VERB} request-field.

If you end up using apache and its mod_proxy/mod_proxy_http modules to
route requests to MarkLogic you may need to turn on:

  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

We at least found some problems between Apache 2.2.x and Marklogic 3.2-2
if we didn't turn those on.

Jim

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
James A. Robinson                       jim.robinson@...
Stanford University HighWire Press      http://highwire.stanford.edu/
+1 650 7237294 (Work)                   +1 650 7259335 (Fax)
Steve Mallen | 2 Aug 09:09 2008

Re: [MarkLogic Dev General] DELETE method not allowed on HTTP Server?

Hi Mike,

Thanks for your reply.  I had suspected that they were not implemented.  
Note that I received a "403 Forbidden" rather than a "405 Method Not 
Allowed" when doing the DELETE.  I've now also tested PUT and found that 
it has the same issue.

Given this restriction, I will probably end up using Apache Tomcat or 
Jetty to intercept the requests, and make XDBC requests to Mark Logic 
from there.  This will give me full URL mapping ability too.

-- Steve

Michael Blakeley wrote:
> Steve,
>
> The misleading error message for DELETE with application-level 
> authentication is a bug, and I understand that a fix is in the works 
> for a future release. As you found, switching to HTTP authentication 
> results in the correct error message (405).
>
> There is an open RFE for HTTPServer support for the DELETE method, but 
> I can't speak to its implementation status. Meanwhile, support for 
> DELETE, PUT, and OPTIONS can be implemented via request-rewriting. One 
> approach is to create a simple Apache module, which rewrites each 
> method to a POST with a method={$VERB} request-field.
>
> -- Mike
>
> Steve Mallen wrote:
(Continue reading)

eric schmidt | 3 Aug 02:16 2008

[MarkLogic Dev General] xcc api - lock

Hello everybody,

I am new to marklogic and I have a very basic question about the xcc api. Is it possible to update a document with DOM and lock it while modifying?

1- open a session
2- get a document as DOM.
3- lock the document (so nobody can update it).
4- modify the DOM document
5- insert the document in the db
6- unlock the document.

I found the XQuery built-in function xdmp:lock-acquire, but it does not seem to work the way I want. I am stocked.

thanks,

eric


            


--
Be Yourself <at> mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com!
<div>
<p>Hello everybody,<br><br>I am new to marklogic and I have a very basic question about the xcc api. Is it possible to update a document with DOM and lock it while modifying?<br><br>1- open a session<br>2- get a document as DOM.<br>3- lock the document (so nobody can update it).<br>4- modify the DOM document<br>5- insert the document in the db<br>6- unlock the document.<br><br>I found the XQuery built-in function xdmp:lock-acquire, but it does not seem to work the way I want. I am stocked.<br><br>thanks,<br><br>eric<br><br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp; <br></p>
<div>

</div>
<br>

--

-- 
<div> Be Yourself  <at>  mail.com!<br>
Choose From 200+ Email Addresses<br>
Get a Free Account at <a href="http://www.mail.com/Product.aspx" target="_blank">www.mail.com</a>!</div>
</div>
Whitby, Rob, CMG | 4 Aug 12:00 2008

[MarkLogic Dev General] Indexes and query tuning

Hi all,
 
I'm trying to implement an auto-complete dropdown which searches a range index with approx 3 million values. The plan is to run a search after the user has typed at least 3 characters, and match that string anywhere in the values. The query I'm using is:
 
(: example search for authors with whi anywhere in their name  :)
let $q := 'whi'
return cts:element-value-match(xs:QName("Author"), concat("*", $q, "*"), ("ascending", "case-insensitive"))
 
This currently takes 10 seconds.
 
I'm hoping that adding some extra indexes will help the performance. Currently I have the following enabled:
- Word searches
- Fast phrase searches
- Fast element word searches
- Fast element trailing wildcard searches
- Three character searches
 
I'm struggling to work out the practical uses of the different indexes - they all sound the same and the documentation just causes more confusion :(
 
Can anyone explain what indexes would improve my query, or is there a better way of writing the query itself?
 
Thanks a lot,
Rob
 
<div>
<div>
<div>
<div><span class="784131409-04082008">Hi 
all,</span></div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div>
<span class="784131409-04082008">I'm trying 
to implement an auto-complete dropdown which searches a range index with approx 
3 million values. </span><span class="784131409-04082008">The plan is to run a search after the user has typed at 
least 3 characters, and match that string anywhere in the values. The query I'm 
using is:</span>
</div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div><span class="784131409-04082008">(: example 
search for authors with whi anywhere in their 
name&nbsp;&nbsp;:)</span></div>
<div><span class="784131409-04082008">let $q := 
'whi' </span></div>
<div><span class="784131409-04082008">return 
cts:element-value-match(xs:QName("Author"), concat("*", $q, "*"), ("ascending", 
"case-insensitive"))</span></div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div><span class="784131409-04082008">This 
currently takes 10 seconds.</span></div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div><span class="784131409-04082008">I'm hoping 
that adding some extra indexes will help the performance. Currently I have the 
following enabled:</span></div>
<div><span class="784131409-04082008">- Word 
searches</span></div>
<div><span class="784131409-04082008">- Fast 
phrase searches</span></div>
<div><span class="784131409-04082008">- Fast 
element word searches</span></div>
<div><span class="784131409-04082008">- Fast 
element trailing wildcard searches</span></div>
<div>
<span class="784131409-04082008">- 
T</span><span class="784131409-04082008">hree character searches</span>
</div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div><span class="784131409-04082008">I'm 
struggling to&nbsp;work out&nbsp;the&nbsp;practical uses of the different 
indexes&nbsp;- they all sound&nbsp;the same&nbsp;and the documentation&nbsp;just 
causes more confusion&nbsp;:(</span></div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
<div>
<span class="784131409-04082008">Can anyone 
explain what indexes would improve my query, or&nbsp;is&nbsp;</span><span class="784131409-04082008">there a better way of 
writing the query itself? </span>
</div>
<div>
<span class="784131409-04082008"></span><span class="784131409-04082008"></span>&nbsp;</div>
<div><span class="784131409-04082008">Thanks a 
lot,</span></div>
<div><span class="784131409-04082008">Rob</span></div>
<div>
<span class="784131409-04082008"></span>&nbsp;</div>
</div>
</div>
</div>
Danny Sokolsky | 4 Aug 18:38 2008

RE: [MarkLogic Dev General] Indexes and query tuning

Hi Rob,

 

Here are a few ideas.

 

1)      If you can get away with not starting the lexicon lookup with a wildcard character, it will probably help a lot.  For example, concat($q, “*”) for your match string instead.

 

2)      Those other index options you mentioned will help with cts:query resolution, but not with the lexicon query.  They can help the lexicon query (especially the three-character searches, which is a 3-char wildcard index) if you constrained your cts:element-value-match with a cts:query.  That might be another idea to speed this up, if you decide you really need the leading wildcard.  Then your query could look something like:

 

cts:element-value-match(xs:QName(“Author”), concat(“*”, $q, “*”), (“ascending”, “case-insensitive”),

        cts:element-word-query(xs:QName(“Author”), concat(“*”, $q, “*”), “wildcarded”) )

 

3)      Another thing to think about is to use a collation for the range index that is case-insensitive, or has some other options like diacritic-insensitive (if that makes sense for your application).  That can lower the number of entries in the index (there would be one entry instead of two for  “E. B. White” and “E. B. WHITE”, for example).

 

-Danny

 

From: general-bounces-ld4jwAGwUXTgXEvjvSGRgMKenhbt+owO@public.gmane.org [mailto:general-bounces-ld4jwAGwUXTgXEvjvSGRgMKenhbt+owO@public.gmane.org] On Behalf Of Whitby, Rob, CMG
Sent: Monday, August 04, 2008 3:01 AM
To: general-ld4jwAGwUXTgXEvjvSGRgMKenhbt+owO@public.gmane.org
Subject: [MarkLogic Dev General] Indexes and query tuning

 

Hi all,

 

I'm trying to implement an auto-complete dropdown which searches a range index with approx 3 million values. The plan is to run a search after the user has typed at least 3 characters, and match that string anywhere in the values. The query I'm using is:

 

(: example search for authors with whi anywhere in their name  :)

let $q := 'whi'

return cts:element-value-match(xs:QName("Author"), concat("*", $q, "*"), ("ascending", "case-insensitive"))

 

This currently takes 10 seconds.

 

I'm hoping that adding some extra indexes will help the performance. Currently I have the following enabled:

- Word searches

- Fast phrase searches

- Fast element word searches

- Fast element trailing wildcard searches

- Three character searches

 

I'm struggling to work out the practical uses of the different indexes - they all sound the same and the documentation just causes more confusion :(

 

Can anyone explain what indexes would improve my query, or is there a better way of writing the query itself?

 

Thanks a lot,

Rob

 

<div>

<div class="Section1">

<p class="MsoNormal"><span>Hi Rob,<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>Here are a few ideas.<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoListParagraph"><span><span>1)<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><span>If you can get away with not starting the lexicon lookup with a
wildcard character, it will probably help a lot.&nbsp; For example, concat($q, &ldquo;*&rdquo;)
for your match string instead.<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoListParagraph"><span><span>2)<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><span>Those other index options you mentioned will help with cts:query
resolution, but not with the lexicon query.&nbsp; They can help the lexicon
query (especially the three-character searches, which is a 3-char wildcard
index) if you constrained your cts:element-value-match with a cts:query.&nbsp;
That might be another idea to speed this up, if you decide you really need the
leading wildcard.&nbsp; Then your query could look something like:<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>cts:element-value-match(xs:QName(&ldquo;Author&rdquo;), concat(&ldquo;*&rdquo;,
$q, &ldquo;*&rdquo;), (&ldquo;ascending&rdquo;, &ldquo;case-insensitive&rdquo;),
<p></p></span></p>

<p class="MsoNormal"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cts:element-word-query(xs:QName(&ldquo;Author&rdquo;), concat(&ldquo;*&rdquo;,
$q, &ldquo;*&rdquo;), &ldquo;wildcarded&rdquo;) )<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoListParagraph"><span><span>3)<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><span>Another thing to think about is to use a collation for the range
index that is case-insensitive, or has some other options like
diacritic-insensitive (if that makes sense for your application).&nbsp; That
can lower the number of entries in the index (there would be one entry instead
of two for &nbsp;&ldquo;E. B. White&rdquo; and &ldquo;E. B. WHITE&rdquo;, for
example).<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<p class="MsoNormal"><span>-Danny<p></p></span></p>

<p class="MsoNormal"><span><p>&nbsp;</p></span></p>

<div>

<div>

<p class="MsoNormal"><span>From:</span><span>
general-bounces@... [mailto:general-bounces@...]
On Behalf Of Whitby, Rob, CMG<br>Sent: Monday, August 04, 2008 3:01 AM<br>To: general@...<br>Subject: [MarkLogic Dev General] Indexes and query tuning<p></p></span></p>

</div>

</div>

<p class="MsoNormal"><p>&nbsp;</p></p>

<div>

<div>

<div>

<p class="MsoNormal"><span>Hi
all,<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>I'm
trying to implement an auto-complete dropdown which searches a range index with
approx 3 million values. The plan is to run a search after the user has typed
at least 3 characters, and match that string anywhere in the values. The query
I'm using is:<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>(:
example search for authors with whi anywhere in their name&nbsp;&nbsp;:)<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>let
$q := 'whi' <p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>return
cts:element-value-match(xs:QName("Author"), concat("*", $q,
"*"), ("ascending", "case-insensitive"))<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>This
currently takes 10 seconds.<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>I'm
hoping that adding some extra indexes will help the performance. Currently I
have the following enabled:<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>-
Word searches<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>-
Fast phrase searches<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>-
Fast element word searches<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>-
Fast element trailing wildcard searches<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>-
Three character searches<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>I'm
struggling to&nbsp;work out&nbsp;the&nbsp;practical uses of the different
indexes&nbsp;- they all sound&nbsp;the same&nbsp;and the
documentation&nbsp;just causes more confusion&nbsp;:(<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Can
anyone explain what indexes would improve my query, or&nbsp;is&nbsp;there a
better way of writing the query itself? <p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Thanks
a lot,<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>Rob<p></p></span></p>

</div>

<div>

<p class="MsoNormal"><span>&nbsp;<p></p></span></p>

</div>

</div>

</div>

</div>

</div>
Phil Oertel | 5 Aug 00:32 2008
Picon

[MarkLogic Dev General] Re: Error obtaining community license key

Hi Gidi,

I ran into the same issue with MarkLogic Server not giving me the key when I clicked the "Give me a Community License" button. You say the support team resolved the issue for you. What was the fix?

Thx,
Phil
<div><div dir="ltr">Hi Gidi,<br><br>I ran into the same issue with MarkLogic Server not giving me the key when I clicked the "Give me a Community License" button. You say the support team resolved the issue for you. What was the fix?<br><br>Thx,<br>Phil<br>
</div></div>
eric schmidt | 5 Aug 01:27 2008

Re: [MarkLogic Dev General] xcc api - lock

Hi,

Does  XCC/J provide any function to lock/unlock access to a document?

regards.

----- Original Message -----
From: "eric schmidt"
To: General-ld4jwAGwUXTgXEvjvSGRgMKenhbt+owO@public.gmane.org
Subject: [MarkLogic Dev General] xcc api - lock
Date: Sat, 2 Aug 2008 19:16:23 -0500

Hello everybody,

I am new to marklogic and I have a very basic question about the xcc api. Is it possible to update a document with DOM and lock it while modifying?

1- open a session
2- get a document as DOM.
3- lock the document (so nobody can update it).
4- modify the DOM document
5- insert the document in the db
6- unlock the document.

I found the XQuery built-in function xdmp:lock-acquire, but it does not seem to work the way I want. I am stocked.

thanks,

eric


            
@public.gmane.org>

--
Be Yourself <at> mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com!

_______________________________________________
General mailing list
General-ld4jwAGwUXTgXEvjvSGRgMKenhbt+owO@public.gmane.org
http://xqzone.com/mailman/listinfo/general

--
Be Yourself <at> mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com!
<div>
<div>
Hi,<br><br>Does&nbsp; XCC/J provide any function to lock/unlock access to a document?<br><br>regards.<br><br><blockquote>----- Original Message -----<br>
From: "eric schmidt" <br>
To: General@...<br>
Subject: [MarkLogic Dev General] xcc api - lock<br>
Date: Sat, 2 Aug 2008 19:16:23 -0500<br><br>

Hello everybody,<br><br>I am new to marklogic and I have a very basic question about the xcc api. Is it possible to update a document with DOM and lock it while modifying?<br><br>1- open a session<br>2- get a document as DOM.<br>3- lock the document (so nobody can update it).<br>4- modify the DOM document<br>5- insert the document in the db<br>6- unlock the document.<br><br>I found the XQuery built-in function xdmp:lock-acquire, but it does not seem to work the way I want. I am stocked.<br><br>thanks,<br><br>eric<br><br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp; <br> <at> public.gmane.org&gt;<div>

</div>
<br>

-- 
<div> Be Yourself  <at>  mail.com!<br>
Choose From 200+ Email Addresses<br>
Get a Free Account at <a href="http://www.mail.com/Product.aspx" target="_blank">www.mail.com</a>!</div>

<br>
_______________________________________________<br>
General mailing list<br>
General@...<br>
http://xqzone.com/mailman/listinfo/general<br>
</blockquote>
</div>
<br>

--

-- 
<div> Be Yourself  <at>  mail.com!<br>
Choose From 200+ Email Addresses<br>
Get a Free Account at <a href="http://www.mail.com/Product.aspx" target="_blank">www.mail.com</a>!</div>
</div>
KONG TIDE | 6 Aug 10:05 2008

[MarkLogic Dev General] Duplicated ID happened.

Hi, All

I want to get a unique id at ML, a xml called ids.xml will store my id just like below:

<id>100</id>

Here is my xquery function, it will update ids.xml file after calling it.

define function nextSomeID($number as xs:integer) as xs:integer

  let $id := doc("ids.xml")/id/text()
  let $nextId := xs:integer($id) + 1
  let $update := xdmp:node-replace($id, text{$nextId + $number - 1})
  return $nextId
}

the java client method (synchronized also) will call this function to get next id, but in fact, I still get duplicated id some times.

Notice:
1) I using multi-thread to call this java method.
2) para $number can be 1,2,3,4...., for example, if $number is 3 and current id=2, nextSomeID will return 3, id will be 2+3=5

So, what situation will happen this? Very confused.

The only possible way is $id get the duplicated value at here:

let $id := doc("ids.xml")/id/text()

But seems before return $nextId, ids.xml has been updated. so, doc("ids.xml")/id/text() will always get latest values, right?

Very confused about that, can anyone explain that?



--
Rgds!

Tide Kong
<div><div dir="ltr">Hi, All<br><br>I want to get a unique id at ML, a xml called ids.xml will store my id just like below:<br><br>&lt;id&gt;100&lt;/id&gt;<br><br>Here is my xquery function, it will update ids.xml file after calling it.<br><br clear="all">define function nextSomeID($number as xs:integer) as xs:integer<br>{&nbsp; <br>&nbsp; let $id := doc("ids.xml")/id/text()<br>&nbsp; let $nextId := xs:integer($id) + 1 <br>&nbsp; let $update := xdmp:node-replace($id, text{$nextId + $number - 1})<br>

&nbsp; return $nextId<br>}<br><br>the
java client method (synchronized also) will call this function to get
next id, but in fact, I still get duplicated id some times.<br><br>Notice:<br>1) I using multi-thread to call this java method.<br>
2) para $number can be 1,2,3,4...., for example, if $number is 3 and current id=2, nextSomeID will return 3, id will be 2+3=5<br><br>So, what situation will happen this? Very confused.<br><br>The only possible way is $id get the duplicated value at here:<br><br>let $id := doc("ids.xml")/id/text()<br><br>But seems before return $nextId, ids.xml has been updated. so, doc("ids.xml")/id/text() will always get latest values, right?<br><br>Very confused about that, can anyone explain that?<br><br><br clear="all"><br>-- <br>Rgds!<br><br>Tide Kong<br>
</div></div>

Gmane