Ejemplo n.º 1
0
        /// <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&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="sql_query">The SQL query string.</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 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));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves multiple documents from 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="returnType">Defines used return type.</param>
        /// <returns>Documents as Dictionary&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }
Ejemplo n.º 3
0
        /// <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&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="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&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Performs retrieve-first command. 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="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&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }
Ejemplo n.º 6
0
        /// <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&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="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&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Searches for similar documents by given text. 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="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&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Performs list-first command. 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="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&lt;string, CPS_SimpleXML&gt; or Dictionary&lt;string, XmlElement&gt;.</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));
        }