小编Rav*_*avi的帖子

cts:uris和cts:搜索返回不同的结果

我有一个奇怪的问题,我正在做cts:uri和cts:search ..而且我的cts:uris给了我7个结果,其中cts:搜索只给出了3个结果..

不知道我做错了什么,希望有人可以指出我做错了什么.我尝试了所有我认识的可能性:) ..遵循我正在运行的代码

xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";

    let $q := '(Dermatolog*) AND ((context:KN)) AND ((gene:"STAT3") AND (indication:"Carcinoma")) AND ((uploadDate:"today")) AND (sort:date_desc)' 


    let $options := 
        <options xmlns="http://marklogic.com/appservices/search">
        <additional-query>
            <cts:collection-query xmlns:cts="http://marklogic.com/cts">
                <cts:uri>http://abc/xyz/type/envelope</cts:uri>
            </cts:collection-query>
        </additional-query>
        <operator name="sort">
            <state name="date_desc">
                <sort-order type="xs:dateTime" direction="descending">
                    <field name="upload_date"/>
                </sort-order>
            </state>
            <state name="date_asc">
                <sort-order type="xs:dateTime" direction="ascending">
                    <field name="upload_date"/>
                </sort-order>
            </state>
        </operator>
        <constraint name="context">
            <range type="xs:string" facet="true">
                <element name="context" ns="http://abc/xyz/metadata"/>
                <facet-option>frequency-order</facet-option>
                <facet-option>descending</facet-option>
            </range>
        </constraint>
        <constraint name="type"> …
Run Code Online (Sandbox Code Playgroud)

marklogic marklogic-8

3
推荐指数
1
解决办法
416
查看次数

Xquery搜索选项中的自定义排序顺序

我正在编写Rest Extension进行搜索,这将获取在JSON嵌套文档中搜索的参数.我能够通过编写自定义约束来完成此操作,然后使用此自定义约束解析搜索文本并构建查询.

我们也可以为排序顺序做同样的事情吗?顺便说一句,我的意思是我根据传递的参数为搜索选项构建排序顺序.

我在其中一个例子中看到,执行以下操作

let $options :=
<search:options>
  <search:operator name="sort">
    <search:state name="relevance">
      <search:sort-order>
        <search:score/>
      </search:sort-order>
    </search:state>
    <search:state name="year">
      <search:sort-order direction="descending" type="xs:gYear"
            collation="">
        <search:attribute ns="" name="year"/>
        <search:element ns="http://marklogic.com/wikipedia"
          name="nominee"/>
      </search:sort-order>
      <search:sort-order>
        <search:score/>
      </search:sort-order>
    </search:state>
  </search:operator>
</search:options>
return
search:search("lange sort:year", $options)
Run Code Online (Sandbox Code Playgroud)

但即便在这里也有一些硬编码要对哪些字段进行排序.我想做自定义约束,在运行时我确定排序顺序列.

这可能吗 ??

marklogic marklogic-8

2
推荐指数
1
解决办法
399
查看次数

Marklogic中JSON文档的日期格式


我正在使用带有日期的JSON文档,我正在尝试创建范围索引.当我这样做ISO8601格式时

2015-11-02T00:00:00-0600
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

IndexerEnv::putRangeIndex: XDMP-RANGEINDEX: Range index error: date "2015-11-02T00:00:00-0600": XDMP-LEXVAL: Invalid lexical value "2015-11-02T00:00:00-0600"
Run Code Online (Sandbox Code Playgroud)

我认为它需要在UTC时间,并且最后还需要一个'Z'表示祖鲁时区,所以我强制测试时间如下

2015-11-02T00:00:00Z
Run Code Online (Sandbox Code Playgroud)

我仍然得到同样的错误..

IndexerEnv::putRangeIndex: XDMP-RANGEINDEX: Range index error: date "2015-11-02T00:00:00Z": XDMP-LEXVAL: Invalid lexical value "2015-11-02T00:00:00Z"
Run Code Online (Sandbox Code Playgroud)

这有什么不对?还有另一个问题,Marklogic是否只在我们在日期添加'Z'(祖鲁时区)时才了解日期?

谢谢

timezone json marklogic marklogic-8

2
推荐指数
1
解决办法
248
查看次数

面对XML标记值

我想在xml标签上进行分面,并在标签值上进行子分面,我有一个像下面这样的xml文档

<TermiteJServiceResponse>
  <EntityTypeHit type="DRUG">
    <HitCollection>
      <Hit type="DRUG" id="CHEMBL1201288">
        <Name>Dantrolene</Name>
      </Hit>
      <Hit type="DRUG" id="CHEMBL286398">
        <Name>Propylene Glycol</Name>
      </Hit>
      <Hit type="DRUG" id="GXC376D7F8C0E7A0C3787E8A2384DC56E80">
        <Name>PEG400</Name>
      </Hit>
    </HitCollection>
  </EntityTypeHit>
  <EntityTypeHit type="COMPOUNDS">
    <HitCollection>
      <Hit type="COMPOUNDS" id="A-409912.5">
        <Name>A-409912.5</Name>
      </Hit>
      <Hit type="COMPOUNDS" id="A-409912">
        <Name>A-409912</Name>
      </Hit>
    </HitCollection>
  </EntityTypeHit>
  <EntityTypeHit type="GENE">
    <HitCollection>
      <Hit type="GENE" id="TRH">
        <Name>thyrotropin-releasing hormone</Name>
      </Hit>
    </HitCollection>
  </EntityTypeHit>
  <EntityTypeHit type="BIOPROC">
    <HitCollection>
      <Hit type="BIOPROC" id="BP70302">
        <Name>infusion</Name>
      </Hit>
      <Hit type="BIOPROC" id="D009200">
        <Name>Myocardial Contraction</Name>
      </Hit>
      <Hit type="BIOPROC" id="BP70198">
        <Name>cmax values</Name>
      </Hit>
      <Hit type="BIOPROC" id="D001835">
        <Name>Body Weight</Name>
      </Hit>
      <Hit type="BIOPROC" id="D062186">
        <Name>Arterial Pressure</Name> …
Run Code Online (Sandbox Code Playgroud)

marklogic marklogic-8

2
推荐指数
1
解决办法
62
查看次数

Marklogic 8休息扩展multpart/form-data与文件上传问题

我在ML8中写了一个小的休息扩展,它基本上存储了上传到ml内容数据库的文件.当我这样做时,我得到以下异常

<error-response xmlns="http://marklogic.com/xdmp/error">
<status-code>500</status-code>
<status>Internal Server Error</status>
<message-code>INTERNAL ERROR</message-code>
<message>XDMP-UPDATEFUNCTIONFROMQUERY: xdmp:function(fn:QName("http://marklogic.com/rest-api/resource/repoLoad","post"), "/marklogic.rest.resource/repoLoad/assets/resource.xqy")($context, $service-params, $input) -- Cannot apply an update function from a query . See the MarkLogic server error log for further detail.</message>
</error-response>
Run Code Online (Sandbox Code Playgroud)

但我确实设置了声明选项xdmp:update"true"; 以下是代码..

module namespace repoLoad = "http://marklogic.com/rest-api/resource/repoLoad";

declare namespace rapi = "http://marklogic.com/rest-api";

declare default function namespace  "http://www.w3.org/2005/xpath-functions";
declare option xdmp:mapping "false";
declare option xdmp:update "true";

(: Function responding to GET method - must use local name 'get':)
declare function repoLoad:get($context as map:map, $params  as map:map) as …
Run Code Online (Sandbox Code Playgroud)

marklogic marklogic-8

1
推荐指数
1
解决办法
192
查看次数

cts:返回空序列的值共现

我试图找到其中有一个属性的所有文件的共同出现<id>在文档的属性..以下是我做的,列出共发生和不正常的代码..可有人建议我在做什么错.

xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
declare namespace prop = "http://marklogic.com/xdmp/property";
import module namespace search = "http://marklogic.com/appservices/search" at "/MarkLogic/appservices/search/search.xqy";


 cts:value-co-occurrences(
              cts:element-reference(xs:QName('prop:id')),
              cts:uri-reference())
Run Code Online (Sandbox Code Playgroud)

我确实在这个属性上创建了元素范围索引 在此输入图像描述

marklogic marklogic-8

1
推荐指数
1
解决办法
129
查看次数

Marklogic搜索语法NEAR Logic

我正在使用ML搜索语法abc NEAR\2 xyz.这个问题NEAR看起来是双向的.是否有可能告诉ML只朝一个方向看.

marklogic marklogic-8

1
推荐指数
1
解决办法
25
查看次数

标签 统计

marklogic ×7

marklogic-8 ×7

json ×1

timezone ×1