public static int SearchOneLocationItems( MainForm main_form, LibraryChannel channel, Stop stop, string strLocation, string strOutputStyle, out List<string> results, out string strError) { strError = ""; results = new List<string>(); long lRet = channel.SearchItem(stop, "<all>", strLocation, // -1, "馆藏地点", "left", // this.textBox_queryWord.Text == "" ? "left" : "exact", // 原来为left 2007/10/18 changed "zh", null, // strResultSetName "", // strSearchStyle "", //strOutputStyle, // (bOutputKeyCount == true ? "keycount" : ""), out strError); if (lRet == -1) return -1; long lHitCount = lRet; long lStart = 0; long lCount = lHitCount; DigitalPlatform.LibraryClient.localhost.Record[] searchresults = null; bool bOutputBiblioRecPath = false; bool bOutputItemRecPath = false; string strStyle = ""; if (strOutputStyle == "bibliorecpath") { bOutputBiblioRecPath = true; strStyle = "id,cols,format:@coldef:*/parent"; } else { bOutputItemRecPath = true; strStyle = "id"; } // 实体库名 --> 书目库名 Hashtable dbname_table = new Hashtable(); // 书目库记录路径,用于去重 Hashtable bilio_recpath_table = new Hashtable(); // 装入浏览格式 for (; ; ) { Application.DoEvents(); // 出让界面控制权 if (stop != null && stop.State != 0) { strError = "检索共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条,用户中断..."; return -1; } lRet = channel.GetSearchResult( stop, null, // strResultSetName lStart, lCount, strStyle, // bOutputKeyCount == true ? "keycount" : "id,cols", "zh", out searchresults, out strError); if (lRet == -1) { strError = "检索共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条," + strError; return -1; } if (lRet == 0) { return 0; } // 处理浏览结果 for (int i = 0; i < searchresults.Length; i++) { DigitalPlatform.LibraryClient.localhost.Record searchresult = searchresults[i]; if (bOutputBiblioRecPath == true) { string strItemDbName = Global.GetDbName(searchresult.Path); string strBiblioDbName = (string)dbname_table[strItemDbName]; if (string.IsNullOrEmpty(strBiblioDbName) == true) { strBiblioDbName = main_form.GetBiblioDbNameFromItemDbName(strItemDbName); dbname_table[strItemDbName] = strBiblioDbName; } string strBiblioRecPath = strBiblioDbName + "/" + searchresult.Cols[0]; if (bilio_recpath_table.ContainsKey(strBiblioRecPath) == false) { results.Add(strBiblioRecPath); bilio_recpath_table[strBiblioRecPath] = true; } } else if (bOutputItemRecPath == true) results.Add(searchresult.Path); } lStart += searchresults.Length; lCount -= searchresults.Length; stop.SetMessage("共命中 " + lHitCount.ToString() + " 条,已装入 " + lStart.ToString() + " 条"); if (lStart >= lHitCount || lCount <= 0) break; } return 0; }