Marklogic:数据不符合查询 [英] Marklogic: Data do not comply with query

查看:130
本文介绍了Marklogic:数据不符合查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:NodeJS客户端,Marklogic 8服务器.

Environment: NodeJS client, Marklogic 8 server.

NodeJS的查询是:

The query from NodeJS is:

var query =  qb.where(
    qb.directory('/root/dir/'),
    qb.scope(
        qb.property('sources'),
        qb.value('brand','MyBrand')
    )
);

翻译后的查询为:

{
    "whereClause": {
        "query": {
            "queries": [
                {
                    "directory-query": {
                        "uri": [
                            "/root/dir/"
                        ]
                    }
                },
                {
                    "container-query": {
                        "json-property": "sources",
                        "value-query": {
                            "json-property": "brand",
                            "text": [
                                "MyBrand"
                            ]
                        }
                    }
                }
            ]
        }
    },
    "queryType": "structured",
    "queryFormat": "json"
}  

查询返回10501个文档.

The query returns 10501 documents.

但是 20个文档不符合查询条件(sources.brand = MyBrand)

不正确的文档"/root/dir/0029aaa0-53dc-11e6-8f88-311cf9885168.json"的样本提取返回:

Sample extract for an incorrect document "/root/dir/0029aaa0-53dc-11e6-8f88-311cf9885168.json" returned:

{
    sources: 
        [
            {
                "somefield1": {
                    "somesubfield": "0D793B77-826A-4E19-BCEF-5F1E5C07271A"
                },
                "somefield2": "6408467",
                "brand": "NA",
                "somefield3": "TEST"
            },
            {
                "somefield": {
                    "somesubfield": "832B4AE2-C817-4960-BF8C-63374E7D1B66"
                },
                "somefield2": "6408467",
                "brand": "NA",
                "somefield3": "TEST"
            }
        ],
    otherFieldsSkipped: true,
    badScope: 
        [
            {
                "brand": "MyBrand",
            },
        ],
}

问题在2个不同的平台上发生.

The problem occurs on 2 different platforms.

只有少数文档中 badScope [0] .brand 与值(MyBrand)匹配的地方不正确.

Only a few documents are incorrect where badScope[0].brand match the value (MyBrand).

谢谢

推荐答案

此行为可能是一个错误.提出支持请求以进行更深入的研究会很好.

This behavior might be a bug. It would be good to file a support request to dig deeper.

当您提交未过滤的查询并且名称正确的父级属性包含名称正确但值不正确的子级属性而文档中其他位置的其他属性与名称相同时,可能会得到误报.子属性和指定值.

It is possible to get false positives when you submit an unfiltered query and the parent property with the correct name contains a child property with the correct name but an incorrect value while a different property elsewhere in the document has the same name as the child property and the specified value.

您可以通过提交过滤查询(速度较慢)或打开元素值位置索引来消除那些误报.

You can eliminate those false positives either by submitting a filtered query (which are slower) or by turning on the element value position index.

默认情况下,Node.js API执行未过滤的查询.

By default, the Node.js API executes unfiltered queries.

要查看是否能解释您所看到的误报,您可以启用过滤:

To see whether that explains the false positives you are seeing, you can turn on filtering:

... the query ...
.withOptions({search:'filtered'})

有关此查询生成器方法的更多信息,请参见:

For more information about this query builder method, see:

http://docs.marklogic.com/jsdoc/queryBuilder.html#withOptions

这篇关于Marklogic:数据不符合查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆