Offhand, it would seem that the solution should be to wrap both <word> and
<range> constraints within a single <constraint name="author">. Even back in
version 5 the documentation for <constraint> indicates that each one needs a
unique name (https://docs.marklogic.com/5.0/search:search#options). Probably a
case where the Search API has been forgiving of the multiple constraints with
the same name until now (or at least post-V5).
On Thu, 6 Aug 2015, Chad Bishop wrote:
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("content")</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
--
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4314 USA
Email: [email protected] Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general