本文整理汇总了C#中DigitalPlatform.rms.Client.RmsChannel.DoSearchEx方法的典型用法代码示例。如果您正苦于以下问题:C# RmsChannel.DoSearchEx方法的具体用法?C# RmsChannel.DoSearchEx怎么用?C# RmsChannel.DoSearchEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DigitalPlatform.rms.Client.RmsChannel
的用法示例。
在下文中一共展示了RmsChannel.DoSearchEx方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemRec
//.........这里部分代码省略.........
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + "参考ID")
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strRefIDList)
+ "</word><match>exact</match><relation>list</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";
if (nDbCount > 0)
{
Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
strQueryXml += "<operator value='OR'/>";
}
strQueryXml += strOneDbQuery;
nDbCount++;
}
}
if (nDbCount > 0)
{
strQueryXml = "<group>" + strQueryXml + "</group>";
}
#if NO
RmsChannel channel = channels.GetChannel(app.WsUrl);
if (channel == null)
{
strError = "get channel error";
return -1;
}
#endif
if (channel == null)
throw new ArgumentException("channel 参数值不能为空", "channel");
Record[] records = null;
long lRet = channel.DoSearchEx(strQueryXml,
"default",
strStyle, // strOuputStyle
nMax,
"zh",
strStyle + ",id", // "id,xml,timestamp",
out records,
out strError);
if (lRet == -1)
goto ERROR1;
// not found
if (lRet == 0)
{
strError = "所有检索词一个也没有命中";
return 0;
}
long lHitCount = lRet;
if (nMax == -1)
nMax = (int)lHitCount;
else
{
if (nMax > lHitCount)
nMax = (int)lHitCount;
}
if (records == null || records.Length == 0)
{
strError = "records error";
return -1;
}
示例2: GetOneItemRec
//.........这里部分代码省略.........
string strQueryXml = "";
{
// 构造检索式
// 新方法只用一个 item 元素,把各个库的 dbname 和 from 都拍紧到同一个 targetlist 中
StringBuilder targetList = new StringBuilder();
for (int i = 0; i < dbnames.Count; i++)
{
string strDbName = dbnames[i];
if (String.IsNullOrEmpty(strDbName) == true)
continue;
if (targetList.Length > 0)
targetList.Append(";");
targetList.Append(strDbName + ":" + strFrom);
}
if (targetList.Length == 0)
{
strError = "没有任何可检索的目标数据库";
return -1;
}
strQueryXml = "<target list='"
+ StringUtil.GetXmlStringSimple(targetList.ToString())
+ "' " + strHint + "><item><word>"
+ StringUtil.GetXmlStringSimple(strBarcode)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>" + nMax.ToString() + "</maxCount></item><lang>zh</lang></target>";
}
if (channel == null)
throw new ArgumentException("channel 参数不应为空", "channel");
Record[] records = null;
long lRet = channel.DoSearchEx(strQueryXml,
"default",
"", // strOuputStyle
1,
"zh",
strStyle + ",id", // "id,xml,timestamp",
out records,
out strError);
if (lRet == -1)
goto ERROR1;
// not found
if (lRet == 0)
{
strError = strFrom + " '" + strBarcode + "' 没有找到";
return 0;
}
long lHitCount = lRet;
if (records == null || records.Length == 0)
{
strError = "records error";
return -1;
}
#if DEBUG
if (StringUtil.IsInList("xml", strStyle) == true
|| StringUtil.IsInList("timestamp", strStyle) == true)
{
Debug.Assert(records[0].RecordBody != null, "");
}
#endif
示例3: GetReaderRecXmlByFrom
//.........这里部分代码省略.........
// 构造检索式
string strQueryXml = "";
for (int i = 0; i < dbnames.Count; i++)
{
string strDbName = dbnames[i];
Debug.Assert(String.IsNullOrEmpty(strDbName) == false, "");
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + strFrom) // 2007/9/14
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strWord)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";
if (i > 0)
{
Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
strQueryXml += "<operator value='OR'/>";
}
strQueryXml += strOneDbQuery;
}
if (dbnames.Count > 0)
{
strQueryXml = "<group>" + strQueryXml + "</group>";
}
#if NO
RmsChannel channel = channels.GetChannel(app.WsUrl);
if (channel == null)
{
strError = "get channel error";
return -1;
}
#endif
Record[] records = null;
long lRet = channel.DoSearchEx(strQueryXml,
"default",
"", // strOuputStyle
1,
"zh",
"id,xml,timestamp",
out records,
out strError);
if (lRet == -1)
goto ERROR1;
// not found
if (lRet == 0)
{
strError = "读者" + strFrom + " '" + strWord + "' 没有找到";
return 0;
}
long lHitCount = lRet;
if (records == null || records.Length == 0)
{
strError = "records error";
return -1;
}
Debug.Assert(records[0].RecordBody != null, "");
// strOutputPath = records[0].Path;
if (nMax >= 1)
recpaths.Add(records[0].Path);
strXml = records[0].RecordBody.Xml;
timestamp = records[0].RecordBody.Timestamp;
// 如果命中结果多于一条,则继续获得第一条以后的各条的path
if (lHitCount > 1 && nMax > 1)
{
// List<string> temp = null;
lRet = channel.DoGetSearchResult(
"default",
0,
Math.Min(nMax, lHitCount),
"zh",
null,
out recpaths,
out strError);
if (lRet == -1)
goto ERROR1;
Debug.Assert(recpaths != null, "");
if (recpaths.Count == 0)
{
strError = "DoGetSearchResult aPath error";
goto ERROR1;
}
}
return (int)lHitCount;
ERROR1:
return -1;
}
示例4: GetItemRecXml
// 2014/9/19 strBarcode 可以包含 @refID: 前缀了
// 2012/1/5 改造为PiggyBack检索
// TODO: 判断strBarcode是否为空
// 获得册记录
// 本函数为了执行效率方面的原因, 不去获得超过1条以上的路径。所返回的重复条数最大为1000
// return:
// -1 error
// 0 not found
// 1 命中1条
// >1 命中多于1条(即便在这种情况下, strOutputPath也返回了第一条的路径)
public int GetItemRecXml(
RmsChannel channel,
string strBarcodeParam,
string strStyle,
out string strXml,
out string strOutputPath,
out byte[] timestamp,
out string strError)
{
strOutputPath = "";
strXml = "";
strError = "";
timestamp = null;
LibraryApplication app = this;
string strBarcode = strBarcodeParam;
string strHead = "@refID:";
string strFrom = "册条码";
if (StringUtil.HasHead(strBarcode, strHead, true) == true)
{
strFrom = "参考ID";
strBarcode = strBarcode.Substring(strHead.Length).Trim();
if (string.IsNullOrEmpty(strBarcode) == true)
{
strError = "字符串 '" + strBarcodeParam + "' 中 参考ID 部分不应为空";
return -1;
}
}
// 构造检索式
string strQueryXml = "";
int nDbCount = 0;
for (int i = 0; i < app.ItemDbs.Count; i++)
{
string strDbName = app.ItemDbs[i].DbName;
// 2008/10/16
if (String.IsNullOrEmpty(strDbName) == true)
continue;
// 2007/4/5 改造 加上了 GetXmlStringSimple()
string strOneDbQuery = "<target list='"
+ StringUtil.GetXmlStringSimple(strDbName + ":" + strFrom)
+ "'><item><word>"
+ StringUtil.GetXmlStringSimple(strBarcode) + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";
// 1000 2011/9/5
if (nDbCount > 0)
{
Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
strQueryXml += "<operator value='OR'/>";
}
strQueryXml += strOneDbQuery;
nDbCount++;
}
if (nDbCount > 0)
{
strQueryXml = "<group>" + strQueryXml + "</group>";
}
string strBrowseStyle = "id,xml,timestamp";
if (strStyle == "parent")
strBrowseStyle = "id,cols,format:@coldef://parent";
Record[] records = null;
long lRet = channel.DoSearchEx(strQueryXml,
"default",
"", // strOuputStyle
1,
"zh",
strBrowseStyle, // "id,xml,timestamp",
out records,
out strError);
if (lRet == -1)
goto ERROR1;
// not found
if (lRet == 0)
{
strError = "册条码号 '" + strBarcode + "' 没有找到";
return 0;
}
long lHitCount = lRet;
if (records == null || records.Length == 0)
//.........这里部分代码省略.........
示例5: GetReaderRecXml
//.........这里部分代码省略.........
+ StringUtil.GetXmlStringSimple(strBarcode)
+ "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>1000</maxCount></item><lang>zh</lang></target>";
if (String.IsNullOrEmpty(strQueryXml) == false) // i > 0
{
Debug.Assert(String.IsNullOrEmpty(strQueryXml) == false, "");
strQueryXml += "<operator value='OR'/>";
}
strQueryXml += strOneDbQuery;
// nInCount++;
}
if (string.IsNullOrEmpty(strQueryXml) == true /*nInCount == 0*/)
{
if (app.ReaderDbs.Count == 0)
strError = "当前尚没有配置读者库";
else
strError = "当前没有可以操作的读者库";
return -1;
}
if (dbnames.Count > 0/*nInCount > 0*/)
{
strQueryXml = "<group>" + strQueryXml + "</group>";
}
#if NO
RmsChannel channel = channels.GetChannel(app.WsUrl);
if (channel == null)
{
strError = "get channel error";
return -1;
}
#endif
Record[] records = null;
long lRet = channel.DoSearchEx(strQueryXml,
"default",
"", // strOuputStyle
1,
"zh",
"id,xml,timestamp",
out records,
out strError);
if (lRet == -1)
goto ERROR1;
// not found
if (lRet == 0)
{
strError = "读者证条码号 '" + strBarcode + "' 没有找到";
return 0;
}
long lHitCount = lRet;
if (records == null || records.Length == 0)
{
strError = "records error";
return -1;
}
Debug.Assert(records[0].RecordBody != null, "");
// strOutputPath = records[0].Path;
if (nMax >= 1)
recpaths.Add(records[0].Path);
strXml = records[0].RecordBody.Xml;
timestamp = records[0].RecordBody.Timestamp;
// 如果命中结果多余一条,则继续获得第一条以后的各条的path
if (lHitCount > 1 && nMax > 1)
{
// List<string> temp = null;
lRet = channel.DoGetSearchResult(
"default",
0,
Math.Min(nMax, lHitCount),
"zh",
null,
out recpaths,
out strError);
if (lRet == -1)
goto ERROR1;
Debug.Assert(recpaths != null, "");
if (recpaths.Count == 0)
{
strError = "DoGetSearchResult recpaths error";
goto ERROR1;
}
}
return (int)lHitCount;
ERROR1:
return -1;
}