ControlProxy/backend/yjs/search.yjs
2022-04-19 09:26:59 +08:00

140 lines
5.8 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//@张宏伟
module SearchModule{
//获取DO的数量 该接口可以用于主页的DO数量
//也可用于全领监管->总体情况概览 里面的“仓库数量”“DO数量” “DO分布情况”三项。
//可以增加一个参数用于过滤返回结果?比如模糊匹配上的就加到返回列表里。
//str.contains(arg..)
//输入参数doId如bdware.txte/Repo
//返回结果一个数组里面是doId"contains"这个参数的列表。
export function getAllRepoCount() {
return executeContract("SearchEngine","getAllRepoCount",arg).result;
//return Global.allRepoCount;
}
export function getAllUserCount() {
return executeContract("SearchEngine","getAllUserCount",arg).result;
//return Global.allRepoCount;
}
export function getAllSearchCount() {
return executeContract("SearchEngine","getAllSearchCount",arg).result;
//return Global.allRepoCount;
}
export function getAllUpdateCount() {
return executeContract("SearchEngine","getAllUpdateCount",arg).result;
//return Global.allRepoCount;
}
export function getAllDoCount() {
return executeContract("SearchEngine","getAllDoCount",arg).result;
//return Global.allRepoCount;
}
//不确定
//{"open":51,"close":49}
export function getAllIndexCount() {
return executeContract("SearchEngine","getAllIndexCount",arg).result;
//return Global.allRepoCount;
}
export function getDoCount(arg){
return executeContract("SearchEngine","getDoCount",arg);
//return {
//"data":[{
// "doId":"bdware.txte/Repo1","count":10}
// ,{
// "doId":"bdware.txte/Repo2","count":12}
// ]};
}
//通过AuditProxy实现 @董瑞 需实现支持多标签索引的put接口。
//======在全领监管->总体情况概览
//使用以下参数获取DO数量变化趋势
// interval=1周/1月/1年。。 eventPrefix的数组里为"irp_register"
//使用以下参数获取操作数量统计
// interavl= endTime-startTime eventPrefix的数组里为""
// 使用以下参数数字对象操作统计
//eventPrefix为["doip","irp"] 已完成√
// 使用以下参数获取doip操作统计
//exentPrefix为["doip_create","doip_update","doip_delete","doip_retrieve","doip_hello","doip_list_operations","doip_search"] 已完成√
// 使用以下参数获取irp操作统计
//exentPrefix为["irp_create","irp_delete","irp_update","irp_batch_create","irp_resolution"] 已完成√
// 使用以下参数获取doip、irp的成功率
//exentPrefix为["irp_op_success","irp_op_failed"]
//exentPrefix为["doip_op_success","doip_op_failed"]
//======在全领监管->总体情况概览
@Description("{\"doId\":\"86.20.100/repo4/bcrs\",\"startTime\":1644390000000, \"endTime\":1644404400000,\"interval\":3600000, \"eventPrefix\":[\"doip_retrieve\", \"doip_update\", \"doip_search\", \"doip_delete\"]}")
export function countRecordByDate(arg){
arg=convertArgToJson(arg);
return executeContract("AutoAudit","countRecordByDate",arg).result;
}
export function testCount(arg){
return {"data":"key"};
}
//=====全域监管:数字对象溯源 针对单个DO的通过SQL查询来实现。
//根据 doId --> 找到“数字对象世系”
//86.500.1/Repo.1/Doab
//根据 doId+时间范围+interval+protocol --> 不同operation的统计数据 AuditProxy)
//countDORecordByDate()
//{"doId":xxxx,"startTime","endTime","interval","eventPrefix":["doip_create","doip_update"]}
//{"eventxxx":[1,2,3],"event2":[1,2,3]}
//根据 doId +查找条件(时间范围 protocol operation user?) +offset/count -->总数+指定条数的数组AuditProxy)
// queryDoRecordByDate
//{"doId":xxxx,"startTime","endTime","eventPrefix":["doip_create","doip_update"]}
//{"count":xx, "data":[{doip_request的某一行。},]}
// queryDoRecordByOffset
//{"doId":xxxx,"offset","count","eventPrefix":["doip_create","doip_update"]}
//{"total":xx,"count":xx, "data":[{doip_request的某一行。},]}
//==============
//DO的元数据
//{
// "date": "...",
// "owner": "...",
// "type": "...",
// "description": "...",
// "schema": "...",
//}
//做成可以根据创建时间范围;标识模糊
//{"type":"creatTime","count":10,"offset":"0","from":"1141363811328","to":"1941363811328"}
export function getDoFilter(arg){
var res=executeContract("SearchEngine","searchByRange",arg);
return res.result;
}
//支持模糊查询、按创建时间查询。
//输入参数:
//type要查询的字段
//keyword:要查询的关键字
//count可选项缺省为20
//offset可选项缺省为0
////{"params":[{"type":"owner","keyword":"说明"},{"type":"doid","keyword":"aibd"}],"count":"10","offset":"0"}
//返回:{"data":[{},{},{}],"count":3}
@ArgSchema({"!params":[{"!type":"string","!keyword":"integer"}],"count":"integer","offset":"integer"})
export function search(arg){
arg = convertArgToJson(arg);
var res=executeContract("SearchEngine","searchByMultiTag",arg);
return res.result;
//ret=[];
//ret.push({
// "doId":"bdware.ss/Repo1/Do.a","name":"数字对象a","meta":{},"owner":"zzz","createTime":1641885492715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.b","name":"数字对象b","meta":{},"owner":"zzz","createTime":1641885322715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.c","name":"数字对象c","meta":{},"owner":"zzz","createTime":1641875492715}
// );
//return {"data":ret,"total":3};
}
export function queryByHash(arg){
arg=convertArgToJson(arg);
return executeContract("AutoAudit","queryByHash",arg.hash).result;
}
export function queryByHashOriginal(arg){
arg=convertArgToJson(arg);
return executeContract("AutoAudit","queryByHashOriginal",arg.hash).result;
}
}