Пример #1
0
 protected SearchClientBase(string query, string lang)
 {
     Configuration = SeekitConfiguration.GetConfiguration();
     QueryTerm     = query;
     _sortOrder    = new List <SortOrder>();
     ((ISearchClient)this).Lang = string.IsNullOrEmpty(lang) ? null : lang;
 }
Пример #2
0
        public string PreformSearch(string jsonData, SeekitConfiguration configuration)
        {
            StreamWriter requestWriter;
            var          retval     = string.Empty;
            var          webRequest = WebRequest.Create(new Uri(configuration.ApiUrl, "search")) as HttpWebRequest;

            if (webRequest != null)
            {
                webRequest.Method      = "POST";
                webRequest.Timeout     = 20000;
                webRequest.ContentType = "application/json";
                using (requestWriter = new StreamWriter(webRequest.GetRequestStream())) {
                    requestWriter.Write(jsonData);
                }

                var response = (HttpWebResponse)webRequest.GetResponse();
                try {
                    var streamReader = new StreamReader(response.GetResponseStream(), true);
                    try {
                        retval = streamReader.ReadToEnd();
                    } finally {
                        streamReader.Close();
                    }
                } finally {
                    response.Close();
                }
            }
            return(retval);
        }
Пример #3
0
        public string FetchAllFacets(SeekitConfiguration configuration, string lang, string modelName)
        {
            var retval        = string.Empty;
            var facetsApiPath = string.Format("facets?client={0}", configuration.ClientGuid);

            if (!string.IsNullOrEmpty(modelName))
            {
                facetsApiPath += "&lang=" + lang;
            }

            if (!string.IsNullOrEmpty(modelName))
            {
                facetsApiPath += "&modeltype=" + modelName;
            }

            var webRequest = WebRequest.Create(new Uri(configuration.ApiUrl, facetsApiPath)) as HttpWebRequest;

            if (webRequest != null)
            {
                webRequest.Method      = "GET";
                webRequest.Timeout     = 20000;
                webRequest.ContentType = "application/json";

                var response = (HttpWebResponse)webRequest.GetResponse();
                try {
                    var streamReader = new StreamReader(response.GetResponseStream(), true);
                    try {
                        retval = streamReader.ReadToEnd();
                    } finally {
                        streamReader.Close();
                    }
                } finally {
                    response.Close();
                }
            }
            return(retval);
        }
Пример #4
0
 public FacetsResolver(SeekitConfiguration configuration)
 {
     _configuration = configuration;
 }
Пример #5
0
 public MultiSearch()
 {
     SearchClients   = new List <ISearchClient>();
     QueryIdToClient = new Dictionary <int, ISearchClient>();
     Configuration   = SeekitConfiguration.GetConfiguration();
 }
Пример #6
0
 public FacetsClient()
 {
     Configuration = SeekitConfiguration.GetConfiguration();
 }