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()); }
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(); }
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); }