Rest 创建对象失败ELEMRIDXNOTFOUND

Rest 创建对象失败ELEMRIDXNOTFOUND,rest,marklogic,Rest,Marklogic,我在MarkLogic上实现基于对象的智能框架,但我看不出我现在缺少了哪个索引 我已经创建了对象,并使用rest扩展从接收到端点的(传感器)数据中提取对象 服务器日志显示: 2015-08-17 15:46:41.763信息:俱乐部应用程序:状态500: XDMP-ELEMRIDXNOTFOUND:cts:element值(xs:QName(“obj:id”),(), “排序规则=”, cts:和查询((cts:集合查询(“对象”), cts:元素范围查询(xs:QName(“对象:类型”),“

我在MarkLogic上实现基于对象的智能框架,但我看不出我现在缺少了哪个索引

我已经创建了对象,并使用rest扩展从接收到端点的(传感器)数据中提取对象

服务器日志显示:

2015-08-17 15:46:41.763信息:俱乐部应用程序:状态500: XDMP-ELEMRIDXNOTFOUND:cts:element值(xs:QName(“obj:id”),(), “排序规则=”, cts:和查询((cts:集合查询(“对象”), cts:元素范围查询(xs:QName(“对象:类型”),“=”,“传感器”, (“collation=”),1), cts:元素范围查询(xs:QName(“scc:id”),“=”, xs:untypedAtomic(“rb-0041”),(),1)),())--无字符串元素范围 {}类型的索引

尝试创建对象的代码块如下所示:

xquery version "1.0-ml";

    import module namespace obj = "http://marklogic.com/solutions/obi/object" at
      "/ext/obi/lib/object-service-lib.xqy",
      "/ext/obi/lib/object-lib.xqy";

    declare namespace sight= "http://klpd.nl/sight";
    declare namespace scc= "http://sensingclues.com/sccs";


    declare variable $source-id external;
    declare variable $result external;
    declare variable $merge external;

    for $object in $result/objects/element()
    let $type := obj:get-type-from-content($object)
    let $existing-object :=
      if ($merge) then
        cts:element-values(xs:QName("obj:id"), (), ("collation=http://marklogic.com/collation/codepoint"), cts:and-query((
          cts:collection-query("object"),
          obj:type-query($type),
          cts:element-range-query(xs:QName("scc:id"), "=", $object//scc:id)
        )))[1]
      else ()
    let $object-id :=
      if ($existing-object) then
        let $detail-id := obj:add-details($existing-object, $object, $source-id,()) (:hk empty workspace-id:)
        return $existing-object
      else
        obj:create-object($object, $source-id)[1]

    return <result id="{$object-id}" type="{$type}"/>
    ', (xs:QName('source-id'), $source-id, xs:QName('result'), $result, xs:QName('merge'), $merge),
    <options xmlns="xdmp:eval"><isolation>different-transaction</isolation></options>)
xquery版本“1.0-ml”;
导入模块命名空间obj=”http://marklogic.com/solutions/obi/object“在
“/ext/obi/lib/object service lib.xqy”,
“/ext/obi/lib/object lib.xqy”;
声明命名空间视景=”http://klpd.nl/sight";
声明命名空间scc=”http://sensingclues.com/sccs";
在外部声明变量$source id;
对外声明变量$result;
声明变量$merge external;
对于$result/objects/element()中的$object
let$type:=obj:从内容($object)获取类型
让$existing对象:=
如果($merge)那么
cts:元素值(xs:QName(“obj:id”),(),(“排序规则=http://marklogic.com/collation/codepoint,cts:和查询((
cts:集合查询(“对象”),
obj:类型查询($type),
元素范围查询(xs:QName(“scc:id”),“=”,$object//scc:id)
)))[1]
else()
让$object id:=
如果($现有对象),则
let$detail id:=obj:add details($existing object,$object,$source id,())(:hk empty workspace id:)
返回$existing对象
其他的
obj:创建对象($object,$source id)[1]
返回
“,(xs:QName('source-id'),$source-id,xs:QName('result'),$result,xs:QName('merge'),$merge),
(不同交易)
添加的此特定任务的ml配置中的索引为:

    <!-- Cluey specific indexes -->
    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://sensingclues.com/sccs</namespace-uri>
      <localname>id</localname>
      <collation>http://marklogic.com/collation/</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>
    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://sensingclues.com/sccs</namespace-uri>
      <localname>source</localname>
      <collation>http://marklogic.com/collation/</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>
    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://sensingclues.com/sccs</namespace-uri>
      <localname>timestamp</localname>
      <collation>http://marklogic.com/collation/</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

一串
http://sensingclues.com/sccs
身份证件
http://marklogic.com/collation/
假的
拒绝
一串
http://sensingclues.com/sccs
来源
http://marklogic.com/collation/
假的
拒绝
一串
http://sensingclues.com/sccs
时间戳
http://marklogic.com/collation/
假的
拒绝
问题:

我缺少什么索引?我是否使用了错误的排序点

编辑:

ml-config.xml中的所有其他元素范围索引:

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/source</namespace-uri>
      <localname>dataset</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://purl.org/dc/terms/</namespace-uri>
      <localname>title</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/object</namespace-uri>
      <localname>label</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/object</namespace-uri>
      <localname>type</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/ontology</namespace-uri>
      <localname>objectDefDirectory</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

    <range-element-index>
      <scalar-type>dateTime</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/source</namespace-uri>
      <localname>contentDateTime</localname>
      <collation></collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

一串
http://marklogic.com/solutions/obi/source
数据集
http://marklogic.com/collation/codepoint
假的
拒绝
一串
http://purl.org/dc/terms/
标题
http://marklogic.com/collation/codepoint
假的
拒绝
一串
http://marklogic.com/solutions/obi/object
标签
http://marklogic.com/collation/codepoint
假的
拒绝
一串
http://marklogic.com/solutions/obi/object
类型
http://marklogic.com/collation/codepoint
假的
拒绝
一串
http://marklogic.com/solutions/obi/ontology
objectDefDirectory
http://marklogic.com/collation/codepoint
假的
拒绝
日期时间
http://marklogic.com/solutions/obi/source
contentDateTime
假的
拒绝
编辑解决方案

缺少索引和排序规则

    <range-element-index>
      <scalar-type>string</scalar-type>
      <namespace-uri>http://marklogic.com/solutions/obi/source</namespace-uri>
      <localname>id</localname>
      <collation>http://marklogic.com/collation/codepoint</collation>
      <range-value-positions>false</range-value-positions>
      <invalid-values>reject</invalid-values>
    </range-element-index>

一串
http://marklogic.com/solutions/obi/source
身份证件
http://marklogic.com/collation/codepoint
假的
拒绝

看起来您在“obj:type”上缺少索引


一串
http://marklogic.com/solutions/obi/object
类型
http://marklogic.com/collation/
假的
拒绝

Dave说了什么-我猜您在应用服务器上运行的查询默认为根排序规则,因此obj:type上的元素范围查询默认为根排序规则,但索引是用于代码点排序规则。

您能告诉我这在哪里吗?obj:type query($type),可能缺少类型索引?在ext/obi/lib/object-lib.xqynope中,这个索引与obi的内容是标准的,所以我有一个,可能是排序规则。。。你有。。。如果我有…错误消息说它正在查找带有marklogic.com/collation的索引,而不是代码点索引。看起来您需要调整使用该索引的代码以指定索引使用的排序规则。结果表明,REST端点使用的是不同的应用程序服务器,而不是控制台界面。在我的ml-config.xml中还混合了两个索引。更改控制台的默认排序规则后,我们设法找到了根本原因,即索引的排序规则错误请参见我的附加编辑中的索引,该索引的排序规则错误
<range-element-index>
  <scalar-type>string</scalar-type>
  <namespace-uri>http://marklogic.com/solutions/obi/object</namespace-uri>
  <localname>type</localname>
  <collation>http://marklogic.com/collation/</collation>
  <range-value-positions>false</range-value-positions>
  <invalid-values>reject</invalid-values>
</range-element-index>