Hi Adam,

search:parse returns an element representing the XML of a cts:query, not a 
cts:query.  You can test this as follows:
$engQuery instance of element() => true
$engQuery instance of cts:query => false

You can pass the XML to the cts:query constructor to get corresponding cts:query
cts:query($engQuery) instance of cts:query => true

So, you can satisfy the cts:or-query as follows:
let $query := cts:or-query((cts:query($engQuery), cts:query($deQuery)))

Bob





--------------------------------------------------------------
Hi again Danny,
 
I appreciate the feedback but I don't think that's the problem. I believe I've 
isolated the issue to the constructor for the cts:or-query. If I try the 
following scenario where I am searching for some query text in both English and 
German using just the cts:or-query (forget the element-query for now):
 
$queryText := "pa",
$engOptions :=
<options xmlns="http://marklogic.com/appservices/search";>
                                <term apply="term">
                                                <empty apply="all-results"/>
                                                
<term-option>lang=en</term-option>
                                </term>
                </options>,
$deOptions :=
<options xmlns="http://marklogic.com/appservices/search";>
                                <term apply="term">
                                                <empty apply="all-results"/>
                                                
<term-option>lang=de</term-option>
                                </term>
                </options>,
$engQuery := search:parse($queryString, $engOptions),
$deQuery := search:parse($queryString, $deOptions),
$query := cts:or-query(($engQuery, $deQuery)),
return search:resolve($query)
 
I keep getting an Internal Server Error for the second to last line "$query := 
cts:or-query(($engQuery, $deQuery))" and the error message is: 
"XDMP-NONMIXEDCOMPLEXCONT: fn:data(<cts:word-query qtextref="cts:text" 
xmlns:cts="http://marklogic.com/cts";><cts:text 
xml:lang="en">pa</cts:text></cts:word-query>) -- Node has complex type with 
non-mixed complex content"
 
In the documentation for the cts:or-query constructor it states that the 
function takes a sequence of cts:querys for input and the documentation for 
search:parse says that the function returns the appropriate cts:query XML. So 
it seems the problem is that in constructing the cts:or-query I am providing 
cts:query XML instead of cts:query nodes? Does this make sense? I've tried 
wrapping the results of the search:parse faunction in cts:query constructors 
like this: cts:or-query((cts:query($engQuery), cts:query($deQuery))). This 
accomplished nothing.
 
Adam
                                          
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to