Esempio n. 1
0
 /// <summary>
 /// Lookups single document in Clusterpoint Server storage. Returned type depends on passed returnType parameter.
 /// If returnType is DOC_TYPE_SIMPLEXML, returns CPS_SimpleXML.
 /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet.
 /// If returnType is DOC_TYPE_STDCLASS, returns XmlElement.
 /// </summary>
 /// <param name="id">Document ID.</param>
 /// <param name="list">Dictionary with keys as xpaths and values as listing options (yes | no | snippet | highlight).</param>
 /// <param name="returnType">Defines used return type.</param>
 /// <returns>Document as CPS_SimpleXml or XmlElement.</returns>
 public Object lookupSingle(string id, Dictionary<string, string> list = null, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS)
 {
     CPS_LookupRequest request = new CPS_LookupRequest(id, list);
     this.p_lastResponse = this.p_connection.sendRequest(request);
     CPS_LookupResponse response = (CPS_LookupResponse)this.p_lastResponse;
     if (response.getDocuments() == null)
         return null;
     if (returnType == CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS)
     {
         Dictionary<string, XmlElement> ret1 = (Dictionary<string, XmlElement>)(response.getDocuments(returnType));
         foreach (KeyValuePair<string, XmlElement> pair in ret1)
             return pair.Value;
     }
     if (returnType == CPS_Response.DOC_TYPE.DOC_TYPE_ARRAY)
     {
         return null;
     }
     if (returnType == CPS_Response.DOC_TYPE.DOC_TYPE_SIMPLEXML)
     {
         Dictionary<string, CPS_SimpleXML> ret3 = (Dictionary<string, CPS_SimpleXML>)(response.getDocuments(returnType));
         foreach (KeyValuePair<string, CPS_SimpleXML> pair in ret3)
             return pair.Value;
     }
     return null;
 }
Esempio n. 2
0
 /// <summary>
 /// Lookups multiple documents in Clusterpoint Server storage. returned type depends on passed returnType parameter.
 /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary&lt;string, CPS_SimpleXML&gt;.
 /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet.
 /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary&lt;string, XmlElement&gt;.
 /// </summary>
 /// <param name="ids">List of document IDs.</param>
 /// <param name="list">Dictionary with keys as xpaths and values as listing options (yes | no | snippet | highlight).</param>
 /// <param name="returnType">Defines used return type.</param>
 /// <returns>Documents as Dictionary&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</returns>
 public Object lookupMultiple(List<string> ids, Dictionary<string, string> list = null, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS)
 {
     CPS_LookupRequest request = new CPS_LookupRequest(ids, list);
     this.p_lastResponse = this.p_connection.sendRequest(request);
     return ((CPS_LookupResponse)this.p_lastResponse).getDocuments(returnType);
 }