Ejemplo n.º 1
0
 public HitStatus GetHits()
 {
     if (_hits == null && _isNotcalled)
     {
         _isNotcalled = false;
         try
         {
             if (!string.IsNullOrEmpty(Response))
             {
                 var temp = JsonSerializer.Get <SearchHits>(Response);
                 if (temp != null && temp.Hits != null)
                 {
                     _hits = temp.Hits;
                 }
             }
         }
         catch (System.Exception e)
         {
             _logger.Error(Response, e);
         }
     }
     if (_hits != null)
     {
         return(_hits);
     }
     return(new HitStatus());
 }
Ejemplo n.º 2
0
		public HitStatus GetHits()
		{
			if (_hits == null && _isNotcalled)
			{
				_isNotcalled = false;
				try
				{
					if (!string.IsNullOrEmpty(Response))
					{
						var temp = JsonSerializer.Get<SearchHits>(Response);
						if (temp != null && temp.Hits != null)
						{
							_hits = temp.Hits;
						}
					}
				}
				catch (System.Exception e)
				{
					_logger.Error(Response, e);
				}

			}
			if (_hits != null) return _hits;
			return new HitStatus();
		}
Ejemplo n.º 3
0
        public SortedList <string, Dictionary <string, object> > GetFields()
        {
            var       result    = new SortedList <string, Dictionary <string, object> >();
            HitStatus hitStatus = GetHits();

            if (hitStatus != null)
            {
                foreach (Hits hit in hitStatus.Hits)
                {
                    var dict = new Dictionary <string, object>();
                    foreach (var fileItem in hit.Source)
                    {
                        if (dict.ContainsKey(fileItem.Key))
                        {
                            object value = dict[fileItem.Key];
                            value = value + "," + fileItem.Value;
                            dict[fileItem.Key] = value;
                        }
                        else
                        {
                            dict.Add(fileItem.Key, fileItem.Value);
                        }
                    }
                    if (dict.Count > 0)
                    {
                        result.Add(hit.Id, dict);
                    }
                }
            }

            return(result);
        }