public string doBack(string sessId) { Resp resp = (Resp)sessionResp[sessId]; if (!canBack(sessId) || (resp == null)) { return(NO_RESULTS); } BT.SimpleRootTile root = resp.resultPair.rootTile; if (root != null) { lock (root) { root.HitCollection.PageBack(); bufferRenderContext bctx = resp.bufferContext; bctx.init(); root.Render(bctx); return(getResultsLabel(root) + (resp.isLocalReq ? bctx.buffer:bctx.bufferForExternalQuery)); } } return(NO_RESULTS); }
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)); } }
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)); } }