Marklogic附加查询和可搜索表达式问题

时间:2018-08-09 15:49:41

标签: marklogic marklogic-9

我的选项文件中同时包含searchable-expressionadditional-query。在我的additional-query中,我拥有cts-field-value-query,当我拥有此内容时,即使得到了空结果我知道有些文档同时与searchable-expressionadditional-query匹配。.当我取出cts:field-value-query时,结果按预期进行。.我包括选项文件和{{1 }} ..我不明白为什么会这样

xdmp:query-plan

xdmp计划如下

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>OncoWatch</cts:uri>
            </cts:collection-query>
             <cts:field-value-query>
                <cts:field>wos_doctype</cts:field>
                <cts:text>Article</cts:text>
                <cts:text>Review</cts:text>
            </cts:field-value-query>
        </cts:and-query>
    </additional-query>
    <searchable-expression xmlns:es="http://marklogic.com/entity-services"
                           xmlns:wos_dps="http://clarivate.com/schema/wok5.27/public/FullRecord">
      /es:envelope/es:raw/wos_dps:REC/wos_dps:static_data/wos_dps:summary/wos_dps:titles/wos_dps:title
    </searchable-expression>
    <term>
        <term-option>case-insensitive</term-option>
        <term-option>punctuation-insensitive</term-option>
        <term-option>whitespace-insensitive</term-option>
        <term-option>wildcarded</term-option>
    </term>
    <return-plan>true</return-plan>
</options>

let $q := '"pancreatic cancer"'


return
search:search($q, $options)

这是我拿出 <search:response snippet-format="snippet" total="0" start="1" page-length="10" xmlns:search="http://marklogic.com/appservices/search"> <search:plan> <qry:query-plan xmlns:qry="http://marklogic.com/cts/query"> <qry:expr-trace>impl:apply-search(map:map(&lt;map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../&gt;), "xdmp:plan", fn:false())</qry:expr-trace> <qry:info-trace>Analyzing path for search: fn:collection()/es:envelope/es:raw/wos_dps:REC/wos_dps:static_data/wos_dps:summary/wos_dps:titles/wos_dps:title</qry:info-trace> <qry:info-trace>Step 1 is searchable: fn:collection()</qry:info-trace> <qry:info-trace>Step 2 is searchable: es:envelope</qry:info-trace> <qry:info-trace>Step 3 is searchable: es:raw</qry:info-trace> <qry:info-trace>Step 4 is searchable: wos_dps:REC</qry:info-trace> <qry:info-trace>Step 5 is searchable: wos_dps:static_data</qry:info-trace> <qry:info-trace>Step 6 is searchable: wos_dps:summary</qry:info-trace> <qry:info-trace>Step 7 is searchable: wos_dps:titles</qry:info-trace> <qry:info-trace>Step 8 is searchable: wos_dps:title</qry:info-trace> <qry:info-trace>Path is fully searchable.</qry:info-trace> <qry:info-trace>Gathering constraints.</qry:info-trace> <qry:info-trace>Search query contributed 3 constraints: cts:and-query((cts:word-query("pancreatic cancer", ("case-insensitive","punctuation-insensitive","whitespace-insensitive","wildcarded","lang=en"), 1), cts:collection-query("OncoWatch"), cts:field-value-query("wos_doctype", ("Article", "Review"), ("lang=en"), 1)), ())</qry:info-trace> <qry:partial-plan> <qry:term-query weight="1"> <qry:key>17396426271722676659</qry:key> </qry:term-query> </qry:partial-plan> <qry:partial-plan> <qry:term-query weight="0"> <qry:key>16172058720999549713</qry:key> <qry:annotation>collection(OncoWatch)</qry:annotation> </qry:term-query> </qry:partial-plan> <qry:partial-plan> <qry:or-two-queries> <qry:term-query weight="1"> <qry:key>8492163112599871394</qry:key> </qry:term-query> <qry:term-query weight="1"> <qry:key>10427204889894421302</qry:key> </qry:term-query> </qry:or-two-queries> </qry:partial-plan> <qry:info-trace>Executing search.</qry:info-trace> <qry:ordering/> <qry:final-plan> <qry:and-query> <qry:term-query weight="0"> <qry:key>3030157765137304984</qry:key> <qry:annotation>descendant(doc-root(element(es:envelope),doc-kind(document)))</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>14623301529635238289</qry:key> <qry:annotation>descendant(element-child(es:envelope/es:raw))</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>2513953156802156363</qry:key> <qry:annotation>descendant(element-child(es:raw/wos_dps:REC))</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>15620627614067983352</qry:key> <qry:annotation>descendant(element-child(wos_dps:REC/wos_dps:static_data))</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>14267880419025656818</qry:key> <qry:annotation>descendant(element-child(wos_dps:static_data/wos_dps:summary))</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>1256980818223445232</qry:key> <qry:annotation>descendant(element-child(wos_dps:summary/wos_dps:titles))</qry:annotation> </qry:term-query> <qry:or-two-queries> <qry:term-query weight="0"> <qry:key>7002325115516888131</qry:key> <qry:annotation>element-child(wos_dps:titles/wos_dps:title)</qry:annotation> </qry:term-query> <qry:term-query weight="0"> <qry:key>14914226620346018347</qry:key> <qry:annotation>link-child(descendant(element-child(wos_dps:titles/wos_dps:title)))</qry:annotation> </qry:term-query> </qry:or-two-queries> <qry:term-query weight="1"> <qry:key>17396426271722676659</qry:key> </qry:term-query> <qry:term-query weight="0"> <qry:key>16172058720999549713</qry:key> <qry:annotation>collection(OncoWatch)</qry:annotation> </qry:term-query> <qry:or-two-queries> <qry:term-query weight="1"> <qry:key>8492163112599871394</qry:key> </qry:term-query> <qry:term-query weight="1"> <qry:key>10427204889894421302</qry:key> </qry:term-query> </qry:or-two-queries> </qry:and-query> </qry:final-plan> <qry:info-trace>Selected 1264 fragments to filter</qry:info-trace> <qry:result estimate="1264"/> </qry:query-plan> </search:plan> <search:qtext>"pancreatic cancer"</search:qtext> <search:metrics> <search:query-resolution-time>PT0.183458S</search:query-resolution-time> <search:total-time>PT0.186923S</search:total-time> </search:metrics> </search:response>

时的计划
cts:field-value-query

1 个答案:

答案 0 :(得分:2)

查询计划表明,在两种情况下都从索引中选择了片段,因此我认为您的字段值查询确实匹配某些内容。它们会被过滤排除。

这可能是由于您可搜索的表达式。它指向信封内深处的一个非常特定的元素,并且您字段的值很可能来自该路径之外的元素。

如果您想影响搜索片段,建议您使用transform-resultspreferred-matches功能而不是可搜索表达式。仅对搜索表达式使用高级元素,例如/ es:envelope / es:raw或/ es:envelope / es:instance,或者根本不使用。

HTH!