import "DAC.yjs" @Permission("RocksDB") //onCreate时初始化rocksdb oracle SearchEngine { function onCreate(){ Global.message = ""; Global.events = []; Global.allSearchCount=0;//搜索次数 Global.allIndexCount=0;//检索次数 Global.allUpdateCount=0;//更新次数 Global.allInvokeCount=0//调用次数 Global.allRepoCount=0;//Repo数量 //SearchEngine监管的Repo数据 Global.allUserCount=0;//用户数量 Global.AllDoCount=0;//Do数量 //SearchEngine监管的Do数据 initDAC(requester); Global.se= org.bdware.datanet.searchengine.SearchEngine.createObj("SearchEngineDoMetaIndex"); } //onRecover初始化索引 function onRecover(){ // Global.se= org.bdware.datanet.searchengine.SearchEngine.createObj("SearchEngineDoMetaIndex"); // Global.message = ""; // Global.events = []; // Global.allSearchCount=0;//搜索次数 // Global.allIndexCount=0;//检索次数 // Global.allUpdateCount=0;//更新次数 // Global.allInvokeCount=0//调用次数 // Global.allRepoCount=0;//Repo数量 // //SearchEngine监管的Repo数据 // Global.allUserCount=0;//用户数量 // Global.AllDoCount=0;//Do数量 // initDAC(requester); } function convertArgToJson(arg){ if (typeof(arg)=='string') return JSON.parse(arg); return arg; } function updateRepoHandler(e) { var ret = "receive event, topic: " + e.topic + " content: " + e.content; var params=JSON.parse(e.content); //print("update"+e.content); //print(params.contractID); var res=executeContract(params.contractID+"","getMetaByOffset",e.content); print("update res "+res.result); jo=JSON.parse(res.result); //print("zzz"+JSON.stringify(jo)); //var jo=res.result; for(var i=0;i0) ret.push({ "doId":obj.key,"count":obj.value/1} ); } return { "data":ret}; } export function testIndex(arg) { return Global.se.test(); } //全量同步 //{"doId":"aibd.govdata.tj/RepoDemo","repoName":"repoDemo","contractID":"repoDemo"} export function fullSync(arg) { //getCount arg=JSON.parse(arg); count=executeContract(arg.contractID+"","getCount","").result; doCountDB = RocksDBUtil.loadDB("./SearchEngineDoCount/","false"); doCountDB.put(arg.doId,count); doCountDB.close(); //print(count); //getMetaByOffset var param={ }; param.count=count/1; param.offset=0; var ret=executeContract(arg.contractID+"","getMetaByOffset",JSON.stringify(param)); var dolist = JSON.parse(ret.result); for(var i=0;i