【问题标题】:Path Range Query not working as expected in MarkLogic路径范围查询在 MarkLogic 中未按预期工作
【发布时间】:2019-02-05 07:46:57
【问题描述】:

我有两种情况,路径范围查询的行为不同-

1. cts:search(fn:doc(), 
       cts:path-range-query("/test/path/node/Id","=","ABC_123"))

上面的查询给了我正确的结果

2. cts:search(fn:doc(), 
           cts:path-range-query("/test/path/node/Id","=","ABC 123"))

第二个查询未获取任何结果。 ABC_123ABC 123 的文档都存在于数据库中

我在/test/path/node/Id 上创建了路径范围索引。

有什么建议吗??

【问题讨论】:

  • 您能分享一个显示此行为的(测试)文档吗?您能否分享一下您正在使用的 MarkLogic 版本?
  • 我使用的是 MarkLogic 9.0.6,似乎是命名空间的问题。在创建路径范围索引期间,我没有在我的管理页面上定义命名空间。这可能是原因?
  • 是的,命名空间肯定是个问题。在 admin ui 中定义一个带有前缀的路径命名空间,并在路径表达式中使用它。路径查询表达式也必须匹配..

标签: xquery marklogic


【解决方案1】:

@Shalini,

我在控制台上测试了这两个查询,在路径几乎没有变化的情况下工作正常:

 I mentioned in path range index is : test/path/node/id instead of /test/path/node/Id

在控制台上测试的文件:

 a.xml:

  <test>
  <path>
  <node><id>ABC 123</id></node>
  </path>
  </test>

b.xml

<test>
<path>
<node><id>ABC_123</id></node>
</path>
</test>

结果来自两个查询。

【讨论】:

  • 这也适用于大写的Id。至少对我有用。
猜你喜欢
  • 2019-10-24
  • 1970-01-01
  • 1970-01-01
  • 2023-03-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-11-13
相关资源
最近更新 更多