protected void BiblioSearchControl1_Search(object sender, DigitalPlatform.OPAC.Web.SearchEventArgs e) { if (WebUtil.PrepareEnvironment(this, ref app, ref sessioninfo) == false) { return; } string strError = ""; string strResultSetNamePrefix = Session.SessionID + "_opac_base"; // "opac_base"; string strResultSetName = GetResultSetName(strResultSetNamePrefix); LibraryChannel channel = sessioninfo.GetChannel(true); // sessioninfo.Channel. channel.Idle += new IdleEventHandler(channel_Idle); try { long lRet = // sessioninfo.Channel. channel.Search( null, e.QueryXml, strResultSetName, "", // strOutputStyle out strError); if (lRet == -1) { goto ERROR1; } #if FILTER app.SetFilterTask(strResultSetName, null); #endif if (app.SearchLog != null) { SearchLogItem log = new SearchLogItem(); log.IP = this.Request.UserHostAddress.ToString(); log.Query = e.QueryXml; log.Time = DateTime.UtcNow; log.HitCount = (int)lRet; log.Format = "searchcount"; app.SearchLog.AddLogItem(log); } // not found if (lRet == 0) { this.BrowseSearchResultControl1.Visible = false; #if FITLER this.filter.Visible = false; #endif strError = "没有找到"; goto ERROR1; } e.ErrorInfo = string.Format( this.BiblioSearchControl1.GetString("hit_records_number"), lRet.ToString()); // e.ErrorInfo = "命中记录 " +lRet.ToString()+ " 条"; this.BrowseSearchResultControl1.Clear(); this.BrowseSearchResultControl1.Visible = true; #if FILTER VisibleFilter(true); #endif this.BrowseSearchResultControl1.ResultSetName = strResultSetName; this.BrowseSearchResultControl1.ResultCount = (int)lRet; this.BrowseSearchResultControl1.StartIndex = 0; // 2008/12/15 #if FILTER this.filter.ResultSetName = strResultSetName; #endif } finally { //sessioninfo.Channel. channel.Idle -= new IdleEventHandler(channel_Idle); sessioninfo.ReturnChannel(channel); } return; ERROR1: e.ErrorInfo = strError; this.BrowseSearchResultControl1.ResultSetName = ""; this.BrowseSearchResultControl1.ResultCount = 0; #if FILTER this.filter.ResultSetName = ""; #endif }
protected void BiblioSearchControl1_Search(object sender, DigitalPlatform.OPAC.Web.SearchEventArgs e) { if (WebUtil.PrepareEnvironment(this, ref app, ref sessioninfo) == false) { return; } string strError = ""; string strResultSetNamePrefix = "opac_base"; string strResultSetName = GetResultSetName(strResultSetNamePrefix); sessioninfo.Channel.Idle += new IdleEventHandler(channel_Idle); try { long lRet = sessioninfo.Channel.Search( null, e.QueryXml, strResultSetName, "", // strOutputStyle out strError); if (lRet == -1) { goto ERROR1; } // not found if (lRet == 0) { this.ViewResultsetControl1.ResultSetName = ""; this.ViewResultsetControl1.Visible = false; strError = "没有找到"; goto ERROR1; } e.ErrorInfo = string.Format( this.BiblioSearchControl1.GetString("hit_records_number"), lRet.ToString()); // e.ErrorInfo = "命中记录 " +lRet.ToString()+ " 条"; /* * this.BrowseSearchResultControl1.Clear(); * this.BrowseSearchResultControl1.Visible = true; * this.BrowseSearchResultControl1.ResultSetName = strResultSetName; * this.BrowseSearchResultControl1.ResultCount = (int)lRet; * this.BrowseSearchResultControl1.StartIndex = 0; // 2008/12/15 * */ this.ViewResultsetControl1.Visible = true; this.ViewResultsetControl1.ResultSetName = strResultSetName; this.ViewResultsetControl1.ResultCount = (int)lRet; this.ViewResultsetControl1.StartIndex = 0; this.resultsetname.Value = strResultSetName; } finally { sessioninfo.Channel.Idle -= new IdleEventHandler(channel_Idle); } return; ERROR1: e.ErrorInfo = strError; this.ViewResultsetControl1.ResultSetName = ""; this.ViewResultsetControl1.ResultCount = 0; this.resultsetname.Value = ""; }
protected void OnSearch(object sender, SearchEventArgs e) { if (this.Search != null) { this.Search(sender, e); this.SetResultInfo(e.ErrorInfo); } }
private void SearchButton_Click(object sender, EventArgs e) { int nSearchMaxResultCount = 5000; // 收集检索式 OpacApplication app = (OpacApplication)this.Page.Application["app"]; if (app != null) nSearchMaxResultCount = app.SearchMaxResultCount; SearchEventArgs es = new SearchEventArgs(); // es.QueryXml = "<test />"; string strError = ""; int nRet = BuildQueryXml( nSearchMaxResultCount, out es.QueryXml, out strError); if (nRet == -1) { this.Page.Response.Write(HttpUtility.HtmlEncode(strError)); this.Page.Response.End(); return; } TextBox xmlbox = (TextBox)FindControl("queryxml"); if (xmlbox != null) { xmlbox.Text = es.QueryXml; } OnSearch(sender, es); }
protected void ItemSearchControl1_Search(object sender, DigitalPlatform.OPAC.Web.SearchEventArgs e) { if (WebUtil.PrepareEnvironment(this, ref app, ref sessioninfo) == false) { return; } string strError = ""; // string strResultSetNamePrefix = "opac_item_base"; string strResultSetNamePrefix = Session.SessionID + "opac_item_base"; string strResultSetName = GetResultSetName(strResultSetNamePrefix); LibraryChannel channel = sessioninfo.GetChannel(true); // sessioninfo.Channel. channel.Idle += new IdleEventHandler(channel_Idle); try { long lRet = // sessioninfo.Channel. channel.Search( null, e.QueryXml, strResultSetName, "", // strOutputStyle out strError); if (lRet == -1) { goto ERROR1; } // not found if (lRet == 0) { this.BrowseSearchResultControl1.Visible = false; strError = "没有找到"; goto ERROR1; } e.ErrorInfo = string.Format( this.ItemSearchControl1.GetString("hit_records_number"), lRet.ToString()); // e.ErrorInfo = "命中记录 " +lRet.ToString()+ " 条"; this.BrowseSearchResultControl1.Clear(); this.BrowseSearchResultControl1.Visible = true; this.BrowseSearchResultControl1.ResultSetName = strResultSetName; this.BrowseSearchResultControl1.ResultCount = (int)lRet; this.BrowseSearchResultControl1.StartIndex = 0; // 2008/12/15 } finally { // sessioninfo.Channel. channel.Idle -= new IdleEventHandler(channel_Idle); sessioninfo.ReturnChannel(channel); } return; ERROR1: /* * Response.Write(HttpUtility.HtmlEncode(strError)); * Response.End(); * */ e.ErrorInfo = strError; this.BrowseSearchResultControl1.ResultSetName = ""; this.BrowseSearchResultControl1.ResultCount = 0; }