Hi, Chad:

The constraint name has to be unique within an options structure.

If you weren't getting an error in previous releases, it is likely that either 
one of the constraints was always ignored or the binding of criteria to a 
constraint was choosing a constraint randomly.

You could experiment with the previous release (setting <debug>true</debug> in 
the options) to see which query was getting used.  If the query for one of the 
constraints is never used, that would tell you which constraint to rename.


Hoping that helps,


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of Chad Bishop 
[[email protected]]
Sent: Thursday, August 06, 2015 9:52 AM
To: [email protected]
Subject: [MarkLogic Dev General] Multiple constraints

Greetings,

I’m working on upgrading from ML 5 to ML 8 and am getting an error with a 
specific search due to multiple constraints being defined for the same element.

Specifically, we have the following defined in our search options (obviously 
more are defined, but these are the relevant ones):

<constraint name="author">
                                <word>
                                        <element ns="" name="meta-value"/>
                                        <term-option>wildcarded</term-option>
                                        
<term-option>case-insensitive</term-option>
                                        
<term-option>diacritic-insensitive</term-option>
                                </word>
</constraint>
<constraint name="author">
                                <range type="xs:string">
                                        <element ns="" name="meta-value"/>
                                        
<facet-option>frequency-order</facet-option>
                                        <facet-option>descending</facet-option>
                                        <facet-option>limit=100</facet-option>
                                </range>
</constraint>

The error I’m getting is:

[1.0-ml] XDMP-AS: (err:XPTY0004) ast:matched-constraint($query-elem, $options, 
$state) -- Invalid coercion: (<constraint name="author" 
xmlns="http://marklogic.com/appservices/search";><word><element ns="" 
name="meta-value"/><term-option>wildcarded<...</constraint>, <constraint 
name="author" xmlns="http://marklogic.com/appservices/search";><range 
type="xs:string" facet="true"><element ns="" name="meta-v...</constraint>) as 
element()?

Stack Trace
In /MarkLogic/appservices/search/ast.xqy on line 2195
In ast:matched-constraint(<search:word-constraint-query 
xmlns:search="http://marklogic.com/appservices/search";><search:constraint-name>author</search:constraint-name><search:t...</search:word-constraint-query>,
 <options 
xmlns="http://marklogic.com/appservices/search";><searchable-expression>fn:collection(&quot;content&quot;)</searc...</options>,
 map:map())

Is there a new way these should be handled in ML 8?

Thanks much,

-Chad


~~~~~~~~~~~
Chad Bishop
Lead Developer
Science Societies


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

Reply via email to