public static MossServerInfoConfigurationSettings GetConfig()
        {
            MossServerInfoConfigurationSettings result = (MossServerInfoConfigurationSettings)ConfigurationBroker.GetSection("mossServerInfoConfigSettings");

            ConfigurationExceptionHelper.CheckSectionNotNull(result, "mossServerInfoConfigSettings");

            return(result);
        }
Пример #2
0
        internal static MossServerInfoConfigurationElement GetConfiguration()
        {
            MossServerInfoConfigurationSettings section = MossServerInfoConfigurationSettings.GetConfig();

            string elementName = GetIncomingMessageTag("documentServer", "documentServer");

            return(section.Servers[elementName]);
        }
Пример #3
0
        public BaseCollection <DCTSearchResult> DCMSearchDoc(string[] keyWords)
        {
            MCS.Library.Core.ServerInfo  serverInfo  = MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].ToServerInfo();
            System.Net.NetworkCredential Credentials = new System.Net.NetworkCredential(serverInfo.Identity.LogOnName, serverInfo.Identity.Password, serverInfo.Identity.Domain);
            string       searchServiceUrl            = MCS.Library.Core.UriHelper.CombinePath(MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].ServerName, MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].MossSearchServiceUrl);
            QueryService queryService = new QueryService(searchServiceUrl, Credentials);

            BaseCollection <DCTSearchResult> result = new BaseCollection <DCTSearchResult>();
            StringBuilder queryXml = new StringBuilder();

            queryXml.Append("<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">");
            queryXml.Append("<Query domain=\"QDomain\">");
            queryXml.Append("<SupportedFormats>");
            queryXml.Append("<Format>");
            queryXml.Append("urn:Microsoft.Search.Response.Document.Document");
            queryXml.Append("</Format>");
            queryXml.Append("</SupportedFormats>");
            queryXml.Append("<Range>");
            queryXml.Append("<Count>50</Count>");
            queryXml.Append("</Range>");
            queryXml.Append("<Context>");
            queryXml.Append("<QueryText language=\"en-US\" type=\"STRING\">");
            foreach (string item in keyWords)
            {
                queryXml.Append(string.Format("{0} ", item));
            }

            queryXml.Append("</QueryText>");
            queryXml.Append("</Context>");
            queryXml.Append("</Query>");

            queryXml.Append("</QueryPacket>");
            try
            {
                using (DocLibContext context = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
                {
                    DataSet dsQueryResult = queryService.QueryEx(queryXml.ToString());
                    IEnumerable <DataRow> drQueryResult = from row in dsQueryResult.Tables[0].AsEnumerable()
                                                          where row.Field <bool>("IsDocument") == true
                                                          select row;
                    foreach (var item in drQueryResult)
                    {
                        DCTSearchResult searchResult = new DCTSearchResult();
                        searchResult.Title = item["Title"].ToString();
                        searchResult.Size  = int.Parse(item["Size"].ToString());
                        searchResult.HitHighlightedSummary = item["HitHighlightedSummary"].ToString();
                        searchResult.LastModifiedDate      = DateTime.Parse(item["Write"].ToString());
                        searchResult.Path = item["Path"].ToString().ToLower().Replace(context.Url.ToLower(), "");
                        result.Add(searchResult);
                    }
                    return(result);
                }
            }
            catch (SoapException ex)
            {
                throw ex;
            }
        }