search:values 当结构化查询有约束时不工作

search:values not working when structured query has a contraint

抱歉问了一个很长的问题,除了这个我不知道如何解释我的问题..

我有一个问题

let $q := '(*) AND ((context:"KN"))'

我的选择

let $options := 
 <options xmlns="http://marklogic.com/appservices/search">
 <constraint name="context">
        <range type="xs:string" facet="true">
            <element name="context" ns="http://ir.abbvienet.com/content-repo/metadata"/>
            <facet-option>frequency-order</facet-option>
            <facet-option>descending</facet-option>
        </range>
    </constraint>
  <constraint name="gene">
        <range type="xs:string" facet="true">
            <path-index>//Hit[@type='GENE']/@id</path-index>
            <facet-option>frequency-order</facet-option>
            <facet-option>descending</facet-option>
            <facet-option>limit=10</facet-option>
        </range>
    </constraint>
  <return-results>false</return-results>
  <return-facets>true</return-facets>
  <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>
    <search-option>unfiltered</search-option>
</options>

当我做的时候search:search($q, $options) 我得到以下结果

   <search:facet name="gene" type="xs:string">
    <search:facet-value name="DMPK" count="846">DMPK</search:facet-value>
    <search:facet-value name="TNF" count="323">TNF</search:facet-value>
    <search:facet-value name="IL6" count="301">IL6</search:facet-value>
    <search:facet-value name="PAGE4" count="297">PAGE4</search:facet-value>
    <search:facet-value name="INS" count="296">INS</search:facet-value>
    <search:facet-value name="PSD" count="291">PSD</search:facet-value>
    <search:facet-value name="EGFR" count="280">EGFR</search:facet-value>
    <search:facet-value name="PAGE3" count="271">PAGE3</search:facet-value>
    <search:facet-value name="PAGE5" count="270">PAGE5</search:facet-value>
    <search:facet-value name="CD4" count="268">CD4</search:facet-value>
    </search:facet>
    <search:qtext>(*) AND ((context:"KN"))</search:qtext>

这是对的,现在我想使用 search:values 来获取 gene 的分面。我执行以下操作

let $valueOptions :=
  <options xmlns="http://marklogic.com/appservices/search">
   <values name="facet">
       <range type="xs:string" facet="true">
        <path-index>//Hit[@type='GENE']/@id</path-index>
      </range>
      <values-option>frequency-order</values-option>
      <values-option>descending</values-option>
   </values>
  </options>


return search:values('facet', $valueOptions, search:parse($q, $options, 'search:query'),(), (), 1, 10) 

我得到以下结果

<search:values-response name="facet" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:search="http://marklogic.com/appservices/search">
<search:distinct-value frequency="12528">EGFR</search:distinct-value>
<search:distinct-value frequency="8305">ERBB2</search:distinct-value>
<search:distinct-value frequency="7997">CD274</search:distinct-value>
<search:distinct-value frequency="7771">PDCD1</search:distinct-value>
<search:distinct-value frequency="7410">ALB</search:distinct-value>
<search:distinct-value frequency="6910">CTLA4</search:distinct-value>
<search:distinct-value frequency="6849">PARP1</search:distinct-value>
<search:distinct-value frequency="6740">MET</search:distinct-value>
<search:distinct-value frequency="6243">BTK</search:distinct-value>
<search:distinct-value frequency="6234">TNF</search:distinct-value>
<metrics xmlns="http://marklogic.com/appservices/search">
<values-resolution-time>PT0.021358S</values-resolution-time>
<total-time>PT0.022609S</total-time>
</metrics>
</search:values-response>

我注意到 search:values 忽略了我的搜索字符串中的约束,或者它没有以正确的方式使用 search:parse 的输出..

为什么输出不一样?我是不是漏了什么

我假设您使用与 search:search 相同的 $qsearch:values 提供数据,但您传入的 $valueOptions 没有 [=] 的约束定义14=].

values 定义添加到 $options,并将其用于 search:values

HTH!