Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Marklogic 搜索:当结构化查询具有约束时,值不起作用_Marklogic_Marklogic 8 - Fatal编程技术网

Marklogic 搜索:当结构化查询具有约束时,值不起作用

Marklogic 搜索:当结构化查询具有约束时,值不起作用,marklogic,marklogic-8,Marklogic,Marklogic 8,抱歉问了这么长时间,我不知道如何解释我的问题,除了这个 我有一个问题 let $q := '(*) AND ((context:"KN"))' 我的选择 let $options := <options xmlns="http://marklogic.com/appservices/search"> <constraint name="context"> <range type="xs:string" facet="true">

抱歉问了这么长时间,我不知道如何解释我的问题,除了这个

我有一个问题

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:values
来获取
基因的切面。。我做了以下几件事

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) 
让$valueOptions:=
//点击[@type='GENE']/@id
频率顺序
下降的
返回搜索:值('facet',$valueOptions,搜索: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>

表皮生长因子受体
ERBB2
CD274
PDCD1
ALB
CTLA4
PARP1
遇见
BTK
肿瘤坏死因子
PT0.021358S
PT0.022609S
我注意到,
search:values
忽略了搜索字符串中的约束,或者它没有正确使用
search:parse
的输出


为什么产出不一样?我是否遗漏了一些内容

我假设您使用与
搜索:搜索
相同的
$q
来馈送
搜索:值
,但您传递的是
$valueOptions
,它没有
上下文
的约束定义

定义添加到
$options
,并将其用于
搜索:值


这就解决了问题。非常感谢。不知何故,我假设
search:parse
在结构化查询中已经有了约束信息
<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>