我想搜索marklogic以双引号开头的词。我正在使用搜索建议。
我正在搜索的术语是“独立”。成功执行后,查询应建议多个选项,其中一个选项为“独立方”。但是它没有返回任何建议。我可以看到搜索建议未找到以双引号开头的术语。请提出我该如何解决。代码在下面共享。
let $options:=<options xmlns="http://marklogic.com/appservices/search">
<additional-query>
<cts:and-query xmlns:cts="http://marklogic.com/cts">
<cts:collection-query>
<cts:uri>myCollection</cts:uri>
</cts:collection-query>
<cts:or-query>
<cts:collection-query>
<cts:uri>anotherCollection</cts:uri>
</cts:collection-query>
</cts:or-query>
</cts:and-query>
</additional-query>
<term>
<term-option>case-insensitive</term-option>
<term-option>punctuation-sensitive</term-option>
<empty apply="all-results">
</empty>
</term>
<constraint name="myTargetItem">
<range collation="http://marklogic.com/collation/codepoint" type="xs:string" facet="false">
<element ns="---" name="targetItem">
</element>
</range>
</constraint>
</options>
let $searchTerm := '"Independent'
let $searchTerm := concat('"*',$searchTerm )
let $searchTerm := concat("myTargetItem", ':', $searchTerm )
return search:suggest($searchTerm , $options,20)
实际结果 空
预期 myTargetItem:“”独立“
答案 0 :(得分:1)
尝试一下:
let $options:=
<options xmlns="http://marklogic.com/appservices/search">
<additional-query>
<cts:and-query xmlns:cts="http://marklogic.com/cts">
<cts:collection-query>
<cts:uri>myCollection</cts:uri>
</cts:collection-query>
<cts:or-query>
<cts:collection-query>
<cts:uri>anotherCollection</cts:uri>
</cts:collection-query>
</cts:or-query>
</cts:and-query>
</additional-query>
<default-suggestion-source>
<range collation="http://marklogic.com/collation/codepoint" type="xs:string"
facet="false">
<element ns="" name="targetItem"/>
</range>
<suggestion-option>case-insensitive</suggestion-option>
<suggestion-option>punctuation-sensitive</suggestion-option>
</default-suggestion-source>
</options>
let $searchTerm := '"Independent'
let $searchTerm := concat('"*',$searchTerm )
let $searchTerm := concat("myTargetItem", ':', $searchTerm )
return search:suggest($searchTerm , $options,20)