Hi Adam,

You don't need that cts:query() wrapper around everything, just use the
cts:or-query() directly.

The cts:query() function creates a query from an XML representation of
it (e.g. if you had placed a query into a document).

Wayne.


On Fri, 2010-03-19 at 11:06 -0700, Adam Patterson wrote: 

> Hi, newbie to XQuery and Marklogic here. I’m trying to do something
> like the following:
> 
>  
> 
>                 ...
> 
>                 $englishQuery := search:parse($queryString,
> $englishOptions),
> 
>                 $germanQuery := search:parse($queryString,
> $germanOptions),
> 
>                 $query :=
> cts:query( cts:or-query((cts:query($englishQuery),
> cts:query($germanQuery)))), 
> 
>                 $results := search:resolve($query,
> bhccSearch:getSearchOptions($target, $page))
> 
>                 return ...
> 
>  
> 
> I have content which is English, and other content which is German,
> and I am trying to build queries which will search both the English
> and German content, and then build a cts:or-query from those, and
> finally build a cts:query from the cts:or-query which I can use with
> search:resolve to return results. I keep getting errors like this:
> 
>  
> 
> XDMP-ARGTYPE: (err:XPTY0004)
> cts:query(cts:or-query((cts:word-query("pa", ("lang=en"), 1),
> cts:word-query("pa", ("lang=de"), 1)))) -- arg1 is not of type
> element()
> 
>  
> 
> So I guess the cts:or-query constructor is not returning me an element
> as needed by the cts:query constructor. Can someone explain why this
> is and how I should handle this?
> 
>  
> 
> Cheers,
> 
>  
> 
> Adam
> 
> 


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

Reply via email to