/// <summary> /// Performs a search command with SQL query. Returns the documents found in a Dictionary with document IDs as keys and document contents as values. Returned document type depends on returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="sql_query">The SQL query string.</param> /// <param name="returnType">Defines used return type.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object sql_search(string sql_query, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_SQLSearchRequest request = new CPS_SQLSearchRequest(sql_query); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_SearchResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Retrieves multiple documents from Clusterpoint Server storage. returned type depends on passed returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="ids">List of document IDs.</param> /// <param name="returnType">Defines used return type.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object retrieveMultiple(List <string> ids, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_RetrieveRequest request = new CPS_RetrieveRequest(ids); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_LookupResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Retrieves modification history of the document by revision ID. Returned type depends on passed returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="id">Document ID.</param> /// <param name="returnDocs">Set to true to return document content (subject to license conditions).</param> /// <param name="returnType">Defines used return type.</param> /// <returns>Revisions as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object showHistory(string id, bool returnDocs = false, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_ShowHistoryRequest request = new CPS_ShowHistoryRequest(id, returnDocs); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_LookupResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Retrieves single document from 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="returnType">Defines used return type.</param> /// <returns>Document as CPS_SimpleXml or XmlElement.</returns> public Object retrieveSingle(string id, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_RetrieveRequest request = new CPS_RetrieveRequest(id); 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); }
/// <summary> /// Performs retrieve-first command. Returned type depends on passed returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="offset">Defines number of document to skip before including in search results.</param> /// <param name="docs">Defines number of documents to return.</param> /// <param name="returnType">Defines used return type.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object retrieveFirst(int offset = -1, int docs = -1, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_RetrieveFirstRequest request = new CPS_RetrieveFirstRequest(offset, docs); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_LookupResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Performs a search command. Returns the documents found in a Dictionary with document IDs as keys and document contents as values. Returned document type depends on returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="query">Query string. See <see cref="CPS.CPS_SearchRequest.setQuery(string)"/> for more info on best practices.</param> /// <param name="offset">Number of documents to skip before including them in results.</param> /// <param name="docs">Maximum document count to return.</param> /// <param name="list">Dictionary with tag xpaths as keys and list options (yes | no | snippet | highlight) as values.</param> /// <param name="ordering">Multiple ordering rules. You can use <see cref="Utils"/> class function to generate these rules.</param> /// <param name="returnType">Defines used return type.</param> /// <param name="stemLang">Defines temming language.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object search(string query, int offset, int docs, Dictionary <string, string> list, List <string> ordering, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS, string stemLang = "") { CPS_SearchRequest request = new CPS_SearchRequest(query, offset, docs, list); if (ordering != null) { request.setOrdering(ordering); } if (stemLang.Length > 0) { request.setStemLang(stemLang); } this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_SearchResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Searches for similar documents by given text. Returned type depends on passed returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="text">Text to search similar documents to.</param> /// <param name="len">Number of keywords to extract.</param> /// <param name="quota">Minimum number of keywords to match.</param> /// <param name="offset">Number of document to skip before including them in response.</param> /// <param name="docs">Number of document to return.</param> /// <param name="returnType">Defines used return type.</param> /// <param name="query">Additional filtering query.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object similarText(string text, int len, int quota, int offset = -1, int docs = -1, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS, string query = "") { CPS_SimilarTextRequest request = new CPS_SimilarTextRequest(text, len, quota, offset, docs, query); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_SearchResponse)this.p_lastResponse).getDocuments(returnType)); }
/// <summary> /// Performs list-first command. Returned type depends on passed returnType parameter. /// If returnType is DOC_TYPE_SIMPLEXML, returns Dictionary<string, CPS_SimpleXML>. /// If returnType is DOC_TYPE_ARRAY, returns null - not supported yet. /// If returnType is DOC_TYPE_STDCLASS, returns Dictionary<string, XmlElement>. /// </summary> /// <param name="list">Dictionary of xpaths as keys and list options (yes | no | snippet | highlight) as values.</param> /// <param name="offset">Defines number of document to skip before including in search results.</param> /// <param name="docs">Defines number of documents to return.</param> /// <param name="returnType">Defines used return type.</param> /// <returns>Documents as Dictionary<string, CPS_SimpleXML> or Dictionary<string, XmlElement>.</returns> public Object listFirst(Dictionary <string, string> list = null, int offset = -1, int docs = -1, CPS_Response.DOC_TYPE returnType = CPS_Response.DOC_TYPE.DOC_TYPE_STDCLASS) { CPS_ListFirstRequest request = new CPS_ListFirstRequest(list, offset, docs); this.p_lastResponse = this.p_connection.sendRequest(request); return(((CPS_LookupResponse)this.p_lastResponse).getDocuments(returnType)); }