Hi Douglass, Glad you are taking the effort to verify my statements. I'm not a Mark Logic expert, so I can be mistaken easily! The long weekend may have contributed as well.. ;-)
I was certain I observed this behaviour in an earlier version of MarkLogic Server, and concluded that it was caused by the fact that searching is for the most part fragment-based. Michael Blakely once explain that for instance the not-query could trick someone. The not-query always takes the whole fragment into consideration. So, it is not usefull to wrap it inside another, let's say, an element-query. So I do think it will help to write queries the way I said, but apparently my statement of the two being equivalent is wrong. I will dig into this more thoroughly. And perhaps a Mark Logic expert is willing to share his/her thoughts as well? Kind regards, Geert > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Glidden, Douglass A > Sent: maandag 10 augustus 2009 17:27 > To: [email protected] > Subject: RE: [MarkLogic Dev General] RE: Multiple Results Retreived > > Geert, > > I've seen you mention this a couple of times, and I got a > little curious this time. I ran a little test, with the finding that > > cts:search(doc()//para, ...) > > and > > cts:search(doc(), ...)//para > > are not equivalent. The first search will return only those > para elements for which the cts:query is true (whether this > is done using indexes if possible or always through filtering > I'm not sure); the second will return all para elements > within any document for which the search terms are true. > Would you please clarify what you mean by this? You > obviously have a much deeper understanding of Mark Logic than > I do, so I want to understand what you are trying to say. > > The test I ran uses a simple document that looks like this: > > <doc> > <para> > <foo>1</foo> > </para> > <para> > <foo>2</foo> > </para> > </doc> > > Then I executed the following two searches: > > 1. > cts:search(fn:doc()//para, > cts:element-value-query(xs:QName("foo"), "1") ) > 2. > cts:search(fn:doc(), > cts:element-value-query(xs:QName("foo"), "1") )//para > > with the following results: > > 1. > <para> > <foo>1</foo> > </para> > 2. > <para> > <foo>1</foo> > </para> > <para> > <foo>2</foo> > </para> > > Of course, I didn't define any fragment roots, so the whole > document is a single fragment. > > Doug Glidden > Software Engineer > The Boeing Company > [email protected] > > > ________________________________ > > From: Geert Josten [mailto:[email protected]] > Sent: Monday, August 10, 2009 08:30 > To: General Mark Logic Developer Discussion > Subject: [MarkLogic Dev General] RE: Multiple Results Retreived > > > Hi Vivek, > > The cts:search searches in fragments, and selects subelements > as expressed in the searchable XPath only afterwards. I > recommend using the following expression instead, just for > clarity. It is equivalent: > > cts:search(doc(), ...)//para > > If you intend to limit the searching to within the para > element, you should use element-query constructors instead. > > HTH.. > > Kind regards, > Geert > > > > > > Drs. G.P.H. Josten > > Consultant > > > > > > <http://www.daidalos.nl/> > > Daidalos BV > > Source of Innovation > > Hoekeindsehof 1-4 > > 2665 JZ Bleiswijk > > Tel.: +31 (0) 10 850 1200 > > Fax: +31 (0) 10 850 1199 > > www.daidalos.nl <http://www.daidalos.nl/> > > KvK 27164984 > > De informatie - verzonden in of met dit emailbericht - is > afkomstig van Daidalos BV en is uitsluitend bestemd voor de > geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, > verzoeken wij u het te verwijderen. Aan dit bericht kunnen > geen rechten worden ontleend. > > > > > > > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
