为什么我无法查询我的OmniIndex区块链的加密字段?

huangapple go评论70阅读模式
英文:

Why can’t I query the encrypted fields of my OmniIndex blockchain?

问题

以下是翻译好的部分:

我期望能够使用已发布的 omniindex runanalyticquery 终端查询我的区块链。

首先,我运行了 getblockschematic,以便我可以看到我想要运行查询的字段...

在我的区块链示意图中,我有两个字段想要运行一些分析,job(未加密)和 info(同态加密)= infosearchableowners

响应摘要:
{
"13": {
"column_name": "infoglobal",
"data_type": "text"
},
"14": {
"column_name": "infosearchableglobal",
"data_type": "text"
},
"15": {
"column_name": "ipv4global",
"data_type": "text"
},
"16": {
"column_name": "ipv4searchableglobal",
"data_type": "text"
},
"17": {
"column_name": "job",
"data_type": "text"
},
}

这是我在 Postman 中的 API 调用(我已经用 Postman 环境变量 {{ }} 遮蔽了私钥)。
{
"analyticQuery": "SELECT job, infoowners FROM WHERE infosearchableowners LIKE 'dignissimos' LIMIT 3",
"unitName": "{{unitName}}",
"server": "{{seedNode}}",
"Type": "Owners",
"user": "{{user}}",
"password": "{{password}}",
"showProtected": "false"
}

但我得到一个空结果响应:
{
"results": []
}

我已经检查过 'dignissimos' 是否在加密字段中。
根据文档,我理解我可以查询加密字段(而不需要解密它们)- 我在这里使用了 "showProtected": "false" 键。
我使用了正确的用户名/密码组合的 'Owner' 类型。

英文:

I am expecting to be able to query my blockchain, using the published omniindex runanalyticquery endpoint.

First I ran getblockschematic, so that I could see the fields I want to run the query against…

In my blockchain schematic I have two fields I want to run some analytics on, job (which is not encrypted)
I am expecting to be able to query my blockchain, using the published omniindex runanalyticquery endpoint.

First I ran getblockschematic, so that I could see the fields I want to run the query against…

In my blockchain schematic I have two fields I want to run some analytics on, job (which is not encrypted) and info (which is homomorphically encrypted) = infosearchableowners

Response extract:
{
"13": {
"column_name": "infoglobal",
"data_type": "text"
},
"14": {
"column_name": "infosearchableglobal",
"data_type": "text"
},
"15": {
"column_name": "ipv4global",
"data_type": "text"
},
"16": {
"column_name": "ipv4searchableglobal",
"data_type": "text"
},
"17": {
"column_name": "job",
"data_type": "text"
},

Here is my API call from Postman (I have obfuscated the private keys with the postman environment variables in {{ }} ).
{
"analyticQuery": "SELECT job, infoowners FROM WHERE infosearchableowners LIKE '{%dignissimos%}' LIMIT
3", "unitName": "{{unitName}}",
"server": "{{seedNode}}",
"Type": "Owners",
"user": "{{user}}",
"password":"{{password}}" ,
"showProtected" : "false"
}
But I get an empty result response:

 {
"results": []
 }

I have checked checked that ‘dignissimos’ is in the encrypted field
My understanding of the documentation is that I can query encrypted fields (without them being decrypted) - I used the “showProtected” : “false” key here.
I’ve used the ‘Owner’ type with correct username / password pairing

答案1

得分: 1

看起来像是密码中的一个简单的拼写错误:

LIKE ''%{dignissimos}%'' LIMIT 3

这是我犯过几次的错误,虽然我确定其他人能够更好地解释,但花括号在百分号符号内部,以搜索加密字段中的密码内容。

无论如何,尝试这个,你应该会得到类似这样的结果:

{
    "info": "数据已被编辑。",
    "job": "动态研究技术员"
},
{
    "info": "数据已被编辑。",
    "job": "投资者可用性协调员"
}

或者你的数据集中的任何内容。我注意到你想要进行一些分析,所以像这样的脚本将返回你查询的所有匹配项的计数(在加密字段上非常有用!)

{
    "analyticQuery": "SELECT COUNT (*) FROM WHERE infosearchableowners LIKE ''%{dignissimos}%'' ",
    "unitName": "{{unitName}}",
    "server": "{{seedNode}}",
    "Type": "Owners",
    "user": "{{user}}",
    "password":"{{password}}",
    "showProtected" : "false"
}
英文:

Looks to me like a simple typo around the cipher:

LIKE '%{dignissimos}%' LIMIT 3

It's a mistake I've made several times and while I am certain others will be able to explain better, the curly brackets are inside the percent symbols in order to search encrypted fields for ciphered contents.

Anyway, try this and you should get a result like this:

{
        "info": "Data has been redacted.",
        "job": "Dynamic Research Technician"
    },
    {
        "info": "Data has been redacted.",
        "job": "Investor Usability Facilitator"
    }

or whatever is in your data set. I note you want to do some analytics, so some script like this would return you a count of all the matches for your query (really useful against an encrypted field!)

{
"analyticQuery": "SELECT COUNT (*) FROM WHERE infosearchableowners LIKE '%{dignissimos}%' ",
"unitName": "{{unitName}}",
"server": "{{seedNode}}",
"Type": "Owners",
"user": "{{user}}",
"password":"{{password}}" ,
"showProtected" : "false"

}

答案2

得分: 1

这是因为您放错了“{”花括号。 这些告诉 OmniIndex API,它所包围的文本是一个 FHE 块,需要作为这样处理。 您可以在 API 文档 Swagger 中查看更多详细信息。通过替换

LIKE '{%dignissimos%}' LIMIT 3",

LIKE '%{dignissimos}%' LIMIT 3",

一切都应该没问题。

英文:

This is because you have a misplaced '{' curly brace. These tell the OmniIndex API that the text it surrounds is a FHE block and needs to be treated as such. You can see more details on this in the API docs Swagger By replacing

LIKE '{%dignissimos%}' LIMIT 3",

with

LIKE '%{dignissimos}%' LIMIT 3",

All should be good

huangapple
  • 本文由 发表于 2023年6月6日 04:32:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409816.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定