public bufferRenderContext(ResultPair rp) { this._rp = rp; this.tileTable = Hashtable.Synchronized(new Hashtable()); this.actionTable = new Hashtable(); init(); }
/// <summary> /// Method for executing the source code /// </summary> /// <param name="startPartitionKey"></param> /// <param name="startRowKey"></param> /// <param name="endPartitionKey"></param> /// <param name="endRowKey"></param> /// <param name="fileName"></param> public static List <LogEntity> Exec(string startPartitionKey, string startRowKey, string endPartitionKey, string endRowKey, string fileName) { //TODO: add UI for the below 3 fields. string tableName = "table1"; AzureTableConnection storage = new AzureTableConnection(tableName); AzureLog result = new AzureLog(); CloudTable table = storage.GetTable(); //If table is null return error to the user. Abort the query List <TableQuery <LogEntity> > listOfQueries = result.GetAllQueries(startPartitionKey, startRowKey, endPartitionKey, endRowKey); List <LogEntity> allLogs = new List <LogEntity>(); foreach (TableQuery <LogEntity> aQuery in listOfQueries) { aQuery.TakeCount = 100; TableContinuationToken token = null; bool first = true; do { ResultPair pair = result.GetResultsAsync(aQuery, table, token, first).Result; first = false; token = pair.token; allLogs.AddRange(pair.logs); }while (token != null); } //List<LogEntity> logs = await result.StartQueryAsync("2016-03-18 15:41", "16", "2016-03-18 15:41", "20"); //List<LogEntity> logs = result.StartQueryAsync(startPartitionKey, startRowKey, endPartitionKey, endRowKey).Result; //WriteLogToFile(startPartitionKey, startRowKey, endPartitionKey, endRowKey, fileName, allLogs); return(allLogs); }
public Resp(ResultPair rp, bufferRenderContext bCtx, bool isLocalReq) { this._rp = rp; this.bufCtx = bCtx; this._localRequest = isLocalReq; this.tileTab = bCtx.table; }
public unsafe int CommonPrefixSearch(byte *key, ResultPair *result, int resultLen, int len, int nodePos = 0) { int b = this.array[nodePos].Base; int num = 0; int n; int p; for (int i = 0; i < len; i++) { p = b; n = this.array[p].Base; if (b == this.array[p].Check && n < 0) { if (num < resultLen) { result[num] = new ResultPair() { Value = -n - 1, Length = i } } ; num++; } p = b + key[i] + 1; if (b == this.array[p].Check) { b = this.array[p].Base; } else { return(num); } } p = b; n = this.array[p].Base; if (b == this.array[p].Check && n < 0) { if (num < resultLen) { result[num] = new ResultPair() { Value = -n - 1, Length = len } } ; num++; } return(num); } #endregion } }
public unsafe int CommonPrefixSearch(byte *key, ResultPair *result, int resultLen, int len, int nodePos = 0) { int b = this.ReadBase(nodePos); int num = 0; int n; Unit p; for (int i = 0; i < len; i++) { this.ReadUnit(b, out p); n = p.Base; if (b == p.Check && n < 0) { if (num < resultLen) { result[num] = new ResultPair(-n - 1, i); } num++; } this.ReadUnit(b + key[i] + 1, out p); if (b == p.Check) { b = p.Base; } else { return(num); } } this.ReadUnit(b, out p); n = p.Base; if (b == p.Check && n < 0) { if (num < resultLen) { result[num] = new ResultPair(-n - 1, len); } num++; } return(num); }
public unsafe int CommonPrefixSearch(byte* key, ResultPair* result, int resultLen, int len, int nodePos = 0) { int b = this.ReadBase(nodePos); int num = 0; int n; Unit p; for (int i = 0; i < len; i++) { this.ReadUnit(b, out p); n = p.Base; if (b == p.Check && n < 0) { if (num < resultLen) result[num] = new ResultPair(-n - 1, i); num++; } this.ReadUnit(b + key[i] + 1, out p); if (b == p.Check) { b = p.Base; } else { return num; } } this.ReadUnit(b, out p); n = p.Base; if (b == p.Check && n < 0) { if (num < resultLen) result[num] = new ResultPair(-n - 1, len); num++; } return num; }
public unsafe int CommonPrefixSearch(byte *key, ResultPair *result, int resultLen, int len, int nodePos = 0) { int num = this.ReadBase(nodePos); int num2 = 0; Unit unit = default(Unit); int @base; for (int i = 0; i < len; i++) { this.ReadUnit(num, out unit); @base = unit.Base; if (num == unit.Check && @base < 0) { if (num2 < resultLen) { result[num2] = new ResultPair(-@base - 1, i); } num2++; } this.ReadUnit(num + key[i] + 1, out unit); if (num != unit.Check) { return(num2); } num = unit.Base; } this.ReadUnit(num, out unit); @base = unit.Base; if (num == unit.Check && @base < 0) { if (num2 < resultLen) { result[num2] = new ResultPair(-@base - 1, len); } num2++; } return(num2); }
public bufferRenderContext (ResultPair rp) { this._rp = rp; this.tileTable = Hashtable.Synchronized(new Hashtable()); this.actionTable = new Hashtable (); init(); }
public string doQuery(webArgs wargs) { if (wargs.sessId == null || wargs.searchString == null || wargs.searchString == "") return NO_RESULTS; log.Debug("WebBackEnd: Got Search String: " + wargs.searchString); Query query = new Query(); query.AddText (wargs.searchString); if (wargs.searchSource != null && wargs.searchSource != "") { query.AddSource(wargs.searchSource); query.AddDomain(QueryDomain.System); } else query.AddDomain (wargs.globalSearch ? QueryDomain.Global:QueryDomain.System); QueryResult qres = new QueryResult (); //Note: QueryDriver.DoQuery() local invocation is used. //The root tile is used only for adding hits and generating html. BT.SimpleRootTile root = new BT.SimpleRootTile (); root.Query = query; //root.SetSource (searchSource); Do not SetSource on root! ResultPair rp = new ResultPair(root); bufferRenderContext bctx = new bufferRenderContext(rp); Resp resp = new Resp(rp, bctx, wargs.isLocalReq); AttachQueryResult (qres, resp); //Add sessionId-Resp mapping if (sessionResp.Contains(wargs.sessId)) sessionResp[wargs.sessId] = resp; else sessionResp.Add(wargs.sessId, resp); log.Info("WebBackEnd: Starting Query for string \"{0}\"", wargs.searchString); QueryDriver.DoQueryLocal (query, qres); //Wait only till we have enough results to display while ((result.Contains(qres)) && (root.HitCollection.NumResults < 10)) Thread.Sleep(100); if (root.HitCollection.IsEmpty) return NO_RESULTS; lock (root) { root.Render(bctx); return (getResultsLabel(root) + (wargs.isLocalReq ? bctx.buffer:bctx.bufferForExternalQuery)); } }
/// <summary> /// Push a docid and a distance to the result set /// </summary> public bool Push(int docid, double d) { double covering = this.CoveringRadius; if (d == covering) { if (this.ceilingKNN) { this.overflow.Add (new ResultPair (docid, d)); } return false; } if (d > covering) { return false; } if (this.InsideUnique != null && this.InsideUnique.Contains (docid)) { return false; } ResultPair r = new ResultPair (docid, d); bool removedLast = false; // we need a default value ResultPair last = new ResultPair (0, 0); // Console.WriteLine ("=== Inserting: {0}, Pool Length: {1}, kmax: {2}, ", r, this.Pool.Count, this.kmax); if (this.pairset.Count >= this.kmax) { removedLast = true; last = this.pairset.RemoveLast (); if (this.InsideUnique != null) { this.InsideUnique.Remove (last.docid); } } this.pairset.Add (r, this.AdaptiveContext); if (this.InsideUnique != null) { this.InsideUnique.Add (docid); } if (removedLast || this.pairset.Count == this.kmax) { this.dmax = this.InnerRadius (); if (this.ceilingKNN) { if (last.dist == this.dmax) { if (this.overflow.Count == 0 || this.overflow [0].dist == last.dist) { this.overflow.Add (last); } else { this.overflow.Clear (); } } else { this.overflow.Clear (); } } } return true; }
public unsafe void ExactMatchSearch(byte* key, ResultPair* result, int len, int nodePos) { *result = this.ExactMatchSearch(key, len, nodePos); }
public string doQuery(webArgs wargs) { if (wargs.sessId == null || wargs.searchString == null || wargs.searchString == "") { return(NO_RESULTS); } log.Debug("WebBackEnd: Got Search String: " + wargs.searchString); Query query = new Query(); query.AddText(wargs.searchString); if (wargs.searchSource != null && wargs.searchSource != "") { query.AddSource(wargs.searchSource); query.AddDomain(QueryDomain.System); } else { query.AddDomain(wargs.globalSearch ? QueryDomain.Global:QueryDomain.System); } QueryResult qres = new QueryResult(); //Note: QueryDriver.DoQuery() local invocation is used. //The root tile is used only for adding hits and generating html. BT.SimpleRootTile root = new BT.SimpleRootTile(); root.Query = query; //root.SetSource (searchSource); Do not SetSource on root! ResultPair rp = new ResultPair(root); bufferRenderContext bctx = new bufferRenderContext(rp); Resp resp = new Resp(rp, bctx, wargs.isLocalReq); AttachQueryResult(qres, resp); //Add sessionId-Resp mapping if (sessionResp.Contains(wargs.sessId)) { sessionResp[wargs.sessId] = resp; } else { sessionResp.Add(wargs.sessId, resp); } log.Info("WebBackEnd: Starting Query for string \"{0}\"", wargs.searchString); QueryDriver.DoQueryLocal(query, qres); //Wait only till we have enough results to display while ((result.Contains(qres)) && (root.HitCollection.NumResults < 10)) { Thread.Sleep(100); } if (root.HitCollection.IsEmpty) { return(NO_RESULTS); } lock (root) { root.Render(bctx); return(getResultsLabel(root) + (wargs.isLocalReq ? bctx.buffer:bctx.bufferForExternalQuery)); } }