[MarkLogic Dev General] Behavior of cts:and-query() with 'ordered'option??

Ian Small ian at marklogic.com
Wed Jul 2 09:22:34 PDT 2008


David -

"ordered" says that the subjects of the and clause need to occur in the
order specified.
So "ordered" of "cat", "dog" says that "cat" has to occur before "dog".
There is only one paragraph (the target of your search, per the first
parameter) that
matches this criteria, so only paragraph is returned.

Cheers
ian 

> -----Original Message-----
> From: general-bounces at developer.marklogic.com 
> [mailto:general-bounces at developer.marklogic.com] On Behalf Of 
> David Sewell
> Sent: Wednesday, July 02, 2008 7:21 AM
> To: General XQZone Discussion
> Subject: [MarkLogic Dev General] Behavior of cts:and-query() 
> with 'ordered'option??
> 
> The API documentation for cts:and-query()
> 
>  http://xqzone.com/pubs/3.2/apidocs/cts-query.html#and-query
> 
> is confusing in its explanation of the effect of the "ordered" option.
> Can anyone explain the logic behind the following differences 
> in output between the default "unordered" and "ordered" options?
> 
> QUERY:
> 
>   xdmp:document-insert(
>     "/test/test.xml",
>     <doc>
>       <p>dog cat</p>
>       <p>dog frog</p>
>       <p>cat dog</p>
>     </doc>
>   );
> 
>   cts:search(
>     doc("/test/test.xml")//p,
>     cts:and-query(
>       ("cat", "dog"),
>       "unordered"    (: default option :)
>     )
>   )
> 
> OUTPUT (as expected):
> 
>   <p>dog cat</p>
>   <p>cat dog</p>
> 
> But with the option changed to "ordered",
> 
> OUTPUT (why?):
> 
>   <p>cat dog</p>
> 
> --
> David Sewell, Editorial and Technical Manager ROTUNDA, The 
> University of Virginia Press PO Box 801079, Charlottesville, 
> VA 22904-4318 USA
> Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
> Email: dsewell at virginia.edu   Tel: +1 434 924 9973
> Web: http://rotunda.upress.virginia.edu/
> 
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
> 


More information about the General mailing list