Hi Danny,

 

That sounds good to me.  The 4.1 documentation implies that multiple or no
expressions are valid:

 

cts:search( 

$expression as node()*,

$query as cts:query?,

[$options as xs:string*], 

[$quality-weight as xs:double?], 

[$forest-ids as xs:unsignedLong*] 

)  as  node()*

 

Why is that?

 

I also found that it does not like supplying the empty set for the
expression, i.e.:

 

cts:search((), $query)

 

Thanks!

 

Tim

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Danny Sokolsky
Sent: Friday, August 12, 2011 12:31 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] What is the syntax for supplying
multiple expressiosn in cts:search?

 

Hi Tim, 

 

You can only search one path and it has to be "searchable".  A searchable
path is a subset of XPath, and you can tell if it is searchable by trying it
in a cts:search and seeing if it throws an exception.  If it does not throw
an exception, it is searchable.

 

In general, you can use unions, so I think this form will work:

 

cts:search(/(foo | bar)//bar, "hello")

 

-Danny

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Tim Meagher
Sent: Friday, August 12, 2011 9:22 AM
To: 'General MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] What is the syntax for supplying multiple
expressiosn in cts:search?

 

I'd like to search multiple paths for a given query when using cts:search.
Given one path it works fine, i.e.

 

cts:search(/ns1:el1, $query)

 

But what if I want to query in multiple paths, e.g.

 

cts:search((/ns1:el1, //ns2:el1), $query)

 

This doesn't seem to work.

 

Tim

 

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

Reply via email to