I'm trying to migrate a search app written in XQuery from MarkLogic 7 to version 8 and I've hit this Known Incompatibility issue about the constraint namespace in the options. I've tried to add the default json/basic namespace and then a custom namespace, didn't work. When I run the below code in Query Console webpage looses connection and reloads after a few seconds. I've even recreated an element range index, after I installed ML 8 all my DBs were recognized, I've reindexed the target DB. Don't know what else could be wrong. Any guidance would be highly appreciated, thanks!
xquery version "1.0-ml";
import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";
declare variable $options :=
<search:options xmlns:search="http://marklogic.com/appservices/search">
<search:search-option>unfiltered</search:search-option>
<search:page-length>30</search:page-length>
<search:term apply="term">
<search:empty apply="all-results"/>
<search:term-option>punctuation-insensitive</search:term-option>
<search:term-option>stemmed</search:term-option>
</search:term>
<search:grammar>
<search:quotation>"</search:quotation>
<search:implicit>
<cts:and-query strength="20" xmlns:cts="http://marklogic.com/cts"/>
</search:implicit>
<search:starter strength="30" apply="grouping" delimiter=")">(</search:starter>
<search:starter strength="40" apply="prefix" element="cts:not-query">-</search:starter>
<search:joiner strength="10" apply="infix" element="cts:or-query" tokenize="word">OR</search:joiner>
<search:joiner strength="20" apply="infix" element="cts:and-query" tokenize="word">AND</search:joiner>
<search:joiner strength="30" apply="infix" element="cts:near-query" tokenize="word">NEAR</search:joiner>
<search:joiner strength="30" apply="near2" consume="2" element="cts:near-query">NEAR/</search:joiner>
<search:joiner strength="50" apply="constraint">:</search:joiner>
<search:joiner strength="50" apply="constraint" compare="LT" tokenize="word">LT</search:joiner>
<search:joiner strength="50" apply="constraint" compare="LE" tokenize="word">LE</search:joiner>
<search:joiner strength="50" apply="constraint" compare="GT" tokenize="word">GT</search:joiner>
<search:joiner strength="50" apply="constraint" compare="GE" tokenize="word">GE</search:joiner>
<search:joiner strength="50" apply="constraint" compare="NE" tokenize="word">NE</search:joiner>
</search:grammar>
<search:additional-query>
<cts:not-query xmlns:cts="http://marklogic.com/cts">
<cts:or-query>
<cts:collection-query>
<cts:uri>ontology</cts:uri>
<cts:uri>Gemeentes</cts:uri>
<cts:uri>Wijken</cts:uri>
<cts:uri>Buurten</cts:uri>
<cts:uri>Wijk_Hierarchy</cts:uri>
<cts:uri>Buurt_Hierarchy</cts:uri>
<cts:uri>Kerncijfers_wijken_en_buurten_2014</cts:uri>
</cts:collection-query>
<cts:element-query>
<cts:element xmlns:sem="http://marklogic.com/semantics">sem:triples</cts:element>
<cts:or-query/>
</cts:element-query>
</cts:or-query>
</cts:not-query>
</search:additional-query>
<search:debug>false</search:debug>
<search:extract-metadata>
<search:qname elem-name="Vhe"/>
<search:qname elem-name="OpnameType"/>
<search:qname elem-name="Plaats"/>
<search:qname elem-name="Straat"/>
<search:constraint-value ref="Plaats"/>
<search:constraint-value ref="Straat"/>
<search:constraint-value ref="Keuken_Beoordeling"/>
<search:constraint-value ref="Badkamer_Beoordeling"/>
<search:constraint-value ref="location"/>
</search:extract-metadata>
<search:transform-results apply="snippet"/>
<search:constraint name="location">
<search:geo-elem-pair>
<search:parent name="location"/>
<search:lat name="lat"/>
<search:lon name="lng"/>
<search:geo-option>units=miles</search:geo-option>
<search:geo-option>coordinate-system=wgs84</search:geo-option>
<search:heatmap n="50.0006240" s="52.384274889550028" w="5.1864790" e="6.8864790" latdivs="14" londivs="19"/>
</search:geo-elem-pair>
</search:constraint>
<search:constraint name="Plaats">
<search:range type="xs:string" collation="http://marklogic.com/collation/">
<search:element name="Plaats"/>
</search:range>
</search:constraint>
<search:constraint name="Straat">
<search:range type="xs:string" collation="http://marklogic.com/collation/">
<search:element name="Straat"/>
</search:range>
</search:constraint>
<search:constraint name="Complex">
<search:range type="xs:string" collation="http://marklogic.com/collation/">
<search:element name="Complex"/>
</search:range>
</search:constraint>
<search:constraint name="Keuken_Beoordeling">
<search:range type="xs:string" collation="http://marklogic.com/collation/">
<search:element name="Keuken_Beoordeling"/>
</search:range>
</search:constraint>
<search:constraint name="Badkamer_Beoordeling">
<search:range type="xs:string" collation="http://marklogic.com/collation/">
<search:element name="Badkamer_Beoordeling"/>
</search:range>
</search:constraint>
<search:return-metrics>true</search:return-metrics>
<search:return-qtext>true</search:return-qtext>
<search:return-query>false</search:return-query>
<search:return-results>true</search:return-results>
<search:return-similar>false</search:return-similar>
<search:sort-order direction="descending">
<search:score/>
<search:annotation>Relevancy (Desc)</search:annotation>
</search:sort-order>
</search:options>;
search:search("wieer", $options, xs:unsignedLong(1), 150)
I've recreated the DB from scratch, copied data with the latest mlcp from the ML 7 DB to the newly created ML 8 DB. Recreated the indexes, but the crash was still happening. Then, I filtered out from the search options which section caused the crash. It is this one:
<search:constraint name="location">
<search:geo-elem-pair>
<search:parent name="location"/>
<search:lat name="lat"/>
<search:lon name="lng"/>
<search:geo-option>units=miles</search:geo-option>
<search:geo-option>coordinate-system=wgs84</search:geo-option>
<search:heatmap n="50.0006240" s="52.384274889550028" w="5.1864790" e="6.8864790" latdivs="14" londivs="19"/>
</search:geo-elem-pair>
</search:constraint>
Once I removed this, was not really using it in the search results, there were no more issues.