On s'en fout ... dès que je peux ... je prends TOUT ;-))) Bisous mbp
-----Message d'origine----- De : [email protected] [mailto:[email protected]] De la part de [email protected] Envoyé : mercredi 8 novembre 2017 17:31 À : [email protected] Objet : General Digest, Vol 161, Issue 8 Send General mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://developer.marklogic.com/mailman/listinfo/general or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of General digest..." Today's Topics: 1. Re: xsl:output, character maps and document-insert (Christopher Hamlin) 2. Re: Full-text search and JSON (Will Thompson) 3. Re: xsl:output, character maps and document-insert (Mary Holstege) 4. Re: xsl:output, character maps and document-insert (Mark Donoghue) ---------------------------------------------------------------------- Message: 1 Date: Wed, 8 Nov 2017 08:49:41 -0500 From: Christopher Hamlin <[email protected]> Subject: Re: [MarkLogic Dev General] xsl:output, character maps and document-insert To: MarkLogic Developer Discussion <[email protected]> Message-ID: <CADX+0QyV+Um+0wDay-bUvg8V4NrQWNnThuTdTpqF87Dc2=w...@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" Sometimes query console output can be misleading, since it's creating a display. Another way to test is xdmp:save to the disk and look there. Do you have a small example to try? /ch On Tue, Nov 7, 2017 at 6:22 PM, Mark Donoghue <[email protected]> wrote: > Hi, > > I am running a query in the query console that retrieves a document > from the database, invokes an XSLT and stores the result over the same document URI. > > The purpose of the XSLT is to unescape double-escaped character > entities > (i.e.: &amp;). Following what I thought was standard practice, the > XSLT replaces &'s with &xE0000; and uses a character map to swap the > private character with an ampersand on output (using the > use-character-maps on the xsl:output element). > > This works fine in oXygen and even in the query console tests where I > output the result document to the output pane. > > The problem occurs when I retrieve the document from the database. The > private character &xE0000; is still in the result document I stored, > and hasn't been replaced with an ampersand. > > Does document-insert (or something) ignore the xsl:output directives > in the stylesheet? > > Am I running into some some query console behavior I'm not aware of > (I'm still rather new at using MarkLogic). > > Any pointers in the right direction will he much appreciated. > > Best, > Mark > > - -- --- ----- -------- ------------- > Mark Donoghue > IEEE > (732) 562-6045 > [email protected] > > IEEE - Advancing Technology for Humanity > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > ------------------------------ Message: 2 Date: Wed, 8 Nov 2017 14:36:54 +0000 From: Will Thompson <[email protected]> Subject: Re: [MarkLogic Dev General] Full-text search and JSON To: MarkLogic Developer Discussion <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset="utf-8" Geert, I think I may have to do something like this to make indexes for JSON docs more easily configurable. -Will > On Nov 7, 2017, at 11:49 PM, Geert Josten <[email protected]> wrote: > > Well, you could give your json doc a root property.. :) > > { root: { id: 1234, text: ??brown fox?? } } > > Cheers > > On 11/8/17, 4:03 AM, "[email protected] on > behalf of Will Thompson" <[email protected] on > behalf of [email protected]> wrote: > >> Hi Rob, >> >> Likewise! I think I just figured it out. I am excluding root in the >> word query index settings. The root of the document I was searching >> for is an object-node though, so I suspect there's no way to include it. >> >> -Will >> >> >>> On Nov 7, 2017, at 8:36 PM, Rob Szkutak <[email protected]> >>> wrote: >>> >>> Hi Will, >>> >>> I hope you are doing well. It's nice to see your name pop up. >>> >>> I tested out your example on a new database in ML 9.0-3 and it >>> worked just fine for me. Can you try to fn:doc() the document and >>> make sure you can see it? If you can, check to make sure your >>> document is not a binary node with xdmp:node-kind(fn:doc("/test.json")/node()) . >>> >>> Best, >>> Rob >>> >>> Rob Szkutak >>> Senior Consultant >>> MarkLogic Corporation >>> www.marklogic.com >>> >>> From: [email protected] >>> <[email protected]> on behalf of Will Thompson >>> <[email protected]> >>> Sent: Tuesday, November 7, 2017 5:36:31 PM >>> To: MarkLogic Developer Discussion >>> Subject: [MarkLogic Dev General] Full-text search and JSON >>> >>> Is it possible to search generally against text tokens in JSON >>> documents? All of the JSON-specific cts:queries require property >>> names, and cts:word-query doesn't appear to match JSON documents. >>> For example, if I have a document with URI "/test.json": >>> >>> { >>> "id" : 1234, >>> "text" : "The quick brown fox jumps over the lazy dog." >>> } >>> >>> cts:search(doc(), "brown fox") returns empty. Is there another way >>> to do this? >>> >>> -Will >>> _______________________________________________ >>> General mailing list >>> [email protected] >>> Manage your subscription at: >>> https://urldefense.proofpoint.com/v2/url?u=http-3A__developer.marklo >>> gic.com_mailman_listinfo_general&d=DwIFAw&c=IdrBOxAMwHPzAikPNzltHw&r >>> =_thRNTuzvzYaEDwaA_AfnAe5hN2lWgi6qdluz6ApLYI&m=0owGAJ2hEyJmo5R7g9-Mg >>> bVrj2F0WG862Wxa423oasY&s=FvHOAGeeBNDlbNT7ycT50wjv1axJzTO740jjRMI_BKk >>> &e= _______________________________________________ >>> General mailing list >>> [email protected] >>> Manage your subscription at: >>> >>> https://urldefense.proofpoint.com/v2/url?u=http-3A__developer.marklo >>> gic.c >>> om_mailman_listinfo_general&d=DwICAg&c=IdrBOxAMwHPzAikPNzltHw&r=_thR >>> NTuzv >>> zYaEDwaA_AfnAe5hN2lWgi6qdluz6ApLYI&m=IL-JssAmKFbFz-tiCY8C6KCgrkw4LBV >>> MCgi9 znH0jKM&s=1DKnkzzBpnXr44ZMhD1XHTPdzU8QtXT0Ie0dhXUx-3o&e= >> >> _______________________________________________ >> General mailing list >> [email protected] >> Manage your subscription at: >> https://urldefense.proofpoint.com/v2/url?u=http-3A__developer.marklog >> ic.com_mailman_listinfo_general&d=DwIFAw&c=IdrBOxAMwHPzAikPNzltHw&r=_ >> thRNTuzvzYaEDwaA_AfnAe5hN2lWgi6qdluz6ApLYI&m=0owGAJ2hEyJmo5R7g9-MgbVr >> j2F0WG862Wxa423oasY&s=FvHOAGeeBNDlbNT7ycT50wjv1axJzTO740jjRMI_BKk&e= > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > https://urldefense.proofpoint.com/v2/url?u=http-3A__developer.marklogi > c.com_mailman_listinfo_general&d=DwIFAw&c=IdrBOxAMwHPzAikPNzltHw&r=_th > RNTuzvzYaEDwaA_AfnAe5hN2lWgi6qdluz6ApLYI&m=0owGAJ2hEyJmo5R7g9-MgbVrj2F > 0WG862Wxa423oasY&s=FvHOAGeeBNDlbNT7ycT50wjv1axJzTO740jjRMI_BKk&e= ------------------------------ Message: 3 Date: Wed, 8 Nov 2017 15:19:50 +0000 From: Mary Holstege <[email protected]> Subject: Re: [MarkLogic Dev General] xsl:output, character maps and document-insert To: MarkLogic Developer Discussion <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset="utf-8" Character maps apply to serializations. What gets stored in the database isn't serialized: it is a data model instance, that isn't serialized unless it is (a) rendered as output from a query (b) saved to disk or (c) explicitly serialized as a string via xdmp:quote. There is a special pass-through that when a document is returned from XSLT and returned as a result of the query, the XSLT serialization options will be applied, but that only works within the context of a single query. Try this: force a serialization using xdmp:quote and saving the reparse of that, e.g. xdmp:document-insert("/my.xml", xdmp:unquote(xdmp:quote($doc)) ) I think that should work. Round-tripping a serialization/parse to/from disk should also work, e.g. xdmp:document-insert("/my.xml", xdmp:document-get("/tmp/my.xml", xdmp:save("/tmp/my.xml",$doc))) Failing that, you'll need to do a manual sweep-replace yourself so that the data model instance you save has the characters in it that you want. //Mary On Tue, 07 Nov 2017 15:22:41 -0800, Mark Donoghue <[email protected]> wrote: > Hi, > > > I am running a query in the query console that retrieves a document > from the database, invokes an XSLT and stores the result over the same > document URI. > > > The purpose of the XSLT is to unescape double-escaped character > entities > (i.e.: > &amp;). Following what I thought was standard practice, the XSLT > replaces &'s with &xE0000; and uses a character map to swap the > private character with an ampersand on output (using the > use-character-maps on the xsl:output element). > > > This works fine in oXygen and even in the query console tests where I > output the result document to the output pane. > > > The problem occurs when I retrieve the document from the database. The > private character &xE0000; is still in the result document I stored, > and hasn't been replaced with an ampersand. > > > Does document-insert (or something) ignore the xsl:output directives > in the stylesheet? > > > Am I running into some some query console behavior I'm not aware of > (I'm still rather new at using MarkLogic). > > > Any pointers in the right direction will he much appreciated. > > > Best, > > Mark > > > - -- --- ----- -------- ------------- > Mark Donoghue > > IEEE > > (732) 562-6045 > > [email protected] > > > IEEE - Advancing Technology for Humanity -- Using Opera's revolutionary email client: http://www.opera.com/mail/ ------------------------------ Message: 4 Date: Wed, 8 Nov 2017 11:31:19 -0500 From: Mark Donoghue <[email protected]> Subject: Re: [MarkLogic Dev General] xsl:output, character maps and document-insert To: MarkLogic Developer Discussion <[email protected]> Message-ID: <CAJ_t+9nEfH=zyps8kguppyy8fhovelzuvnhmpzyd2b1o-vb...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Christopher, thank you for responding :-) I was experimenting with your suggestion (it worked) when Mary's response arrived. Mary, thank you for the information and workaround! It was surprising to find out the difference between writing back to the database and serializing. I assumed it would be serialized everywhere. Best, Mark - -- --- ----- -------- ------------- Mark Donoghue IEEE (732) 562-6045 [email protected] IEEE - Advancing Technology for Humanity On Wed, Nov 8, 2017 at 10:19 AM, Mary Holstege <[email protected]> wrote: > > Character maps apply to serializations. What gets stored in the > database isn't serialized: it is a data model instance, that isn't > serialized unless it is (a) rendered as output from a query (b) saved > to disk or (c) explicitly serialized as a string via xdmp:quote. > > There is a special pass-through that when a document is returned from > XSLT and returned as a result of the query, the XSLT serialization > options will be applied, but that only works within the context of a single query. > > Try this: force a serialization using xdmp:quote and saving the > reparse of that, e.g. > xdmp:document-insert("/my.xml", xdmp:unquote(xdmp:quote($doc)) ) > > I think that should work. Round-tripping a serialization/parse to/from > disk should also work, e.g. > xdmp:document-insert("/my.xml", xdmp:document-get("/tmp/my.xml", > xdmp:save("/tmp/my.xml",$doc))) > > Failing that, you'll need to do a manual sweep-replace yourself so > that the data model instance you save has the characters in it that you want. > > //Mary > > > On Tue, 07 Nov 2017 15:22:41 -0800, Mark Donoghue > <[email protected]> > wrote: > > > Hi, > > > > > > I am running a query in the query console that retrieves a document > > from the database, invokes an XSLT and stores the result over the > > same document URI. > > > > > > The purpose of the XSLT is to unescape double-escaped character > > entities > > (i.e.: > > &amp;). Following what I thought was standard practice, the XSLT > > replaces &'s with &xE0000; and uses a character map to swap the > > private character with an ampersand on output (using the > > use-character-maps on the xsl:output element). > > > > > > This works fine in oXygen and even in the query console tests where > > I output the result document to the output pane. > > > > > > The problem occurs when I retrieve the document from the database. > > The private character &xE0000; is still in the result document I > > stored, and hasn't been replaced with an ampersand. > > > > > > Does document-insert (or something) ignore the xsl:output directives > > in the stylesheet? > > > > > > Am I running into some some query console behavior I'm not aware of > > (I'm still rather new at using MarkLogic). > > > > > > Any pointers in the right direction will he much appreciated. > > > > > > Best, > > > > Mark > > > > > > - -- --- ----- -------- ------------- Mark Donoghue > > > > IEEE > > > > (732) 562-6045 > > > > [email protected] > > > > > > IEEE - Advancing Technology for Humanity > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://developer.marklogic.com/pipermail/general/attachments/20171108/f36eab ff/attachment.html ------------------------------ _______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general End of General Digest, Vol 161, Issue 8 *************************************** _______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
