//public override IEnumerable<ELModels.SearchResultFilterData> returnSportResult(ElasticClient EsClient, QueryContainer _objNestedQuery, string IndexName) //{ // EsClient = oLayer.CreateConnection(); // searchcricket sc = new searchcricket(); // IEnumerable<SearchResultFilterData> _objSearchResultFilterData = new List<SearchResultFilterData>(); // var result = EsClient.Search<SearchCricketData>(s => s.Index(IndexName).Query(q => _objNestedQuery).Size(27394)); // _objSearchResultFilterData = SearchResultFilterDataMap(result); // return _objSearchResultFilterData; // //throw new NotImplementedException(); //} public ExtendedSearchResultFilterData searchStoryTeller(ELModels.MatchDetail _objMatchDetail, QueryContainer _objNestedQuery, dynamic _objS1Data, Dictionary <string, object> ObjectArray, IEnumerable <SearchResultFilterData> obj, string value, string IndexName) { EsClient = oLayer.CreateConnection(); ExtendedSearchResultFilterData _objSearchResults = new ExtendedSearchResultFilterData(); _objSearchResults.ResultData = new List <SearchResultFilterData>(); _objSearchResults.Master = new MasterDatas(); _objSearchResults.Master.MasterData = new Dictionary <string, object>(); CommonFunction cf = new CommonFunction(); Cricket objDetails = new Cricket(); //searchcricket sc = new searchcricket(); // SportType = sc.getType(_objMatchDetail.SportID); //if ("CRICKET" == SportType) { //string ReqShotType = _objS1Data["ShotType"]; string ReqDeliveryType = _objS1Data["DeliveryType"]; //string[] _objReqShotType = ReqShotType.Contains(",") ? _objReqShotType = ReqShotType.Split(",") : _objReqShotType = new string[] { _objS1Data["ShotType"] }; //string[] _objReqDeliveryType = ReqDeliveryType.Contains(",") ? _objReqDeliveryType = ReqDeliveryType.Split(",") : _objReqDeliveryType = new string[] { _objS1Data["DeliveryType"] }; //ObjectArray = GetDropdowns(_objNestedQuery, ObjectArray, EsClient, "cricket", GetColumnForEntity(13), _objReqShotType); //ObjectArray = GetDropdowns(_objNestedQuery, ObjectArray, EsClient, "cricket", GetColumnForEntity(32), _objReqDeliveryType); //_objSearchResults.Master.MasterData = ObjectArray; Dictionary <string, object> ddlDropdowns = new Dictionary <string, object>(); GetMatchDetails _objMatchDetails = new GetMatchDetails(); ddlDropdowns = _objMatchDetails.bindS1Dropdown(_objS1Data); if (value != null) { string[] valuess = value.Split(","); foreach (var items in valuess) { var item = items.Split("::"); string Type = _objS1Data[item[0]]; string[] _objType = Type.Contains(",") ? _objType = Type.Split(",") : _objType = new string[] { Type }; foreach (KeyValuePair <string, object> entry in ddlDropdowns) { // if (_objType.ToString() != "") { if (item.ToString().Split(",")[0] != entry.Key.ToString()) { if (entry.Value.ToString() != "") { QueryContainer query = new TermQuery { Field = entry.Key, Value = entry.Value }; _objNestedQuery &= query; } } //} } _objSearchResults.Master.MasterData = objCs.fetchDropdowns(_objNestedQuery, _objSearchResults.Master.MasterData, EsClient, IndexName, cf.GetColumnForEntity(Convert.ToInt16(item[1])), _objType); } } obj = objDetails.returnSportResult(EsClient, _objNestedQuery, IndexName); _objSearchResults.ResultData = obj; return(_objSearchResults); //throw new NotImplementedException(); }
public IActionResult GetSearchResultsFilterTemp(STFilterRequestData _objReqData) { try { Cricket objCS = new Cricket(); GetMatchDetails objMatchDet = new GetMatchDetails(); EsClient_obj = oLayer.CreateConnection(); ExtendedSearchResultFilterData _objSearchResults = new ExtendedSearchResultFilterData(); ExtendedSearchResultFilterData _objSearchResults2 = new ExtendedSearchResultFilterData(); ExtendedSearchResultFilterData _objResult = new ExtendedSearchResultFilterData(); _objResult.ResultData = new List <SearchResultFilterData>(); _objSearchResults2.ResultData = new List <SearchResultFilterData>(); _objSearchResults.ResultData = new List <SearchResultFilterData>(); _objResult.Master = new MasterDatas(); _objResult.Master.MasterData = new Dictionary <string, object>(); _objSearchResults.Master = new MasterDatas(); _objSearchResults.Master.MasterData = new Dictionary <string, object>(); QueryContainer _objNestedQuery = new QueryContainer(); if (_objReqData != null) { MatchDetail _objMatchDetail = _objReqData.MatchDetail; dynamic _objS1Data = _objReqData.S1Data; MatchSituation _objMatchSituation = _objReqData.MatchSituation; Moments _objMomentsData = _objReqData.Moments; string value = sqObj.GetKeyValueForSport(sc.getType(_objMatchDetail.SportID), "DropdwonKey"); List <string> valueObj = sqObj.GetKeyValueForSportTemp(sc.getType(_objMatchDetail.SportID).ToLower(), "PlayerDetails"); string SportName = sc.getType(_objMatchDetail.SportID); if (_objS1Data != null) { _objNestedQuery = objMatchDet.getDetailsAsPerSport(_objS1Data, _objNestedQuery, _objMatchDetail, _objMatchSituation, valueObj, _objMatchDetail.SportID); _objSearchResults = objCf.searchStoryTeller(_objMatchDetail, _objNestedQuery, _objS1Data, _objResult.Master.MasterData, _objResult.ResultData, value, SportName.ToLower()); } if (_objMomentsData != null) { QueryContainer objMoment = new QueryContainer(); objMoment = objCf.getMomentDetailsQueryST(_objMatchDetail, objMoment, _objMomentsData); _objSearchResults2.ResultData = objCS.returnSportResult(EsClient_obj, objMoment, SportName); } _objResult.ResultData = _objSearchResults.ResultData.Union(_objSearchResults2.ResultData); _objResult.Master = _objSearchResults.Master; if (_objMatchDetail.SportID == 1) { string[] _objReqInnings = _objMatchSituation.Innings.Contains(",") ? _objReqInnings = _objMatchSituation.Innings.Split(',') : _objReqInnings = new string[] { _objMatchSituation.Innings }; var innings = objCS.fetchDropDownForMatch(_objResult.Master.MasterData, _objReqInnings); //_objResult.Master.MasterData.Add("Innings", innings); } } return(Ok(new { responseText = _objResult })); } catch (Exception ex) { return(BadRequest()); } }
public async Task GetMatch_DoesNotThrow(string guid) { var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var result = await Global.Session.Query(query); Assert.IsInstanceOf(typeof(Match), result); }
public async Task GetMatch_IsSerializable(string guid) { var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var result = await Global.Session.Query(query); SerializationUtility <Match> .AssertRoundTripSerializationIsPossible(result); }
public async Task Query_DoesNotThrow(string guid) { var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var result = await _mockSession.Query(query); Assert.IsInstanceOf(typeof(Match), result); Assert.AreEqual(_response, result); }
public async Task GetMatch_SchemaIsValid(string guid) { var jSchema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Schema)) }); var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var jArray = await Global.Session.Get <JObject>(query.Uri); SchemaUtility.AssertSchemaIsValid(jSchema, jArray); }
public async Task GetMatch_ModelMatchesSchema(string guid) { var schema = JSchema.Parse(File.ReadAllText(Schema), new JSchemaReaderSettings { Resolver = new JSchemaUrlResolver(), BaseUri = new Uri(Path.GetFullPath(Schema)) }); var matchId = new Guid(guid); var query = new GetMatchDetails(matchId) .SkipCache(); var result = await Global.Session.Query(query); var json = JsonConvert.SerializeObject(result); var jContainer = JsonConvert.DeserializeObject <JObject>(json); SchemaUtility.AssertSchemaIsValid(schema, jContainer); }
public Task <Option <MatchDetailsView, Error> > Handle( GetMatchDetails request, CancellationToken cancellationToken) => _matchRepository.GetByIdAsync(request.Id) .SomeNotNullAsync(Error.NotFound($"No match with id {request.Id} was found.")) .MapAsync(async match => SafetyMap(match));
public void Uri_MatchesExpected(string guid) { var query = new GetMatchDetails(new Guid(guid)); Assert.AreEqual($"https://www.haloapi.com/stats/hw2/matches/{guid}", query.Uri); }