admin管理员组文章数量:1202393
I am using Marklogic's Structured Query definition for searching document in my database. As a part of this I am trying to use container query for searching a term within a specific hierarchy in my document. While doing so, I found that the search API returns the result even if the term is present anywhere within the document instead of the specified hierarchy. On debugging further we found that the structured query XML (generated through code) works fine and gives proper result when we execute it through ML Query Console. Below is the structured query XML we are using for querying database:
<query xmlns="; xmlns:xs="; xmlns:search="; xmlns:xsi=";>
<search:and-query>
<search:and-query>
<search:container-query>
<search:element ns="" name="citations"></search:element>
<search:term-query>
<search:text>Abdallah</search:text>
<search:weight>0.0</search:weight>
</search:term-query>
</search:container-query>
</search:and-query>
<search:collection-query>
<search:uri>bmv</search:uri>
</search:collection-query>
</search:and-query>
</query>
Below is the ML Query Console function details we executed:
xquery version "1.0-ml";
import module namespace search = "; at "/MarkLogic/appservices/search/search.xqy";
let $query :=
<query xmlns="; xmlns:xs="; xmlns:search="; xmlns:xsi=";>
<search:and-query>
<search:and-query>
<search:container-query>
<search:element ns="" name="citations"></search:element>
<search:term-query>
<search:text>Abdallah</search:text>
<search:weight>0.0</search:weight>
</search:term-query>
</search:container-query>
</search:and-query>
<search:collection-query>
<search:uri>bmv</search:uri>
</search:collection-query>
</search:and-query>
</query>
let $options :=
<options xmlns="xdmp:eval">
<user-id>{xdmp:user("patent_poc-writer")}</user-id>
</options>
return xdmp:invoke-function(function(){search:resolve($query)}, $options)
Above we want to get result only if the term is present within citations
element which works fine when I execute the query through Marklogic Query Console, but when I hit the same XML using MarkLogic search API endpoint it gives the result back even if the term is not present within the citations
element but present anywhere within the document.
本文标签:
版权声明:本文标题:Structured Container Query giving wrong result when executed through search API endpoint but works fine on marklogic query conso 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738650967a2104868.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论