public IActionResult getOffField(STFilterRequestData _objReqData) { searchcricket sc = new searchcricket(); List <SearchResultFilterData> obj = new List <SearchResultFilterData>(); BoolQuery _objNestedBoolQuery = new BoolQuery(); if (_objReqData != null) { MatchDetail _objMatchDetail = _objReqData.MatchDetail; Moments _objMomentsData = _objReqData.Moments; if (_objMomentsData != null) { if (_objMomentsData.IsBigMoment || _objMomentsData.IsFunnyMoment || _objMomentsData.IsAudioPiece) { QueryContainer _objNestedBoolQueryFor2 = new QueryContainer(); _objNestedBoolQueryFor2 = sc.GetMatchDetailQueryST(_objNestedBoolQueryFor2, _objMatchDetail); _objNestedBoolQueryFor2 = sc.GetS2MomentDetailQueryForST(_objMatchDetail, _objNestedBoolQueryFor2, _objMomentsData); var result = EsClient.Search <SearchResultFilterData>(s => s.Index("cricket").Query(q => _objNestedBoolQueryFor2).Size(10000)); foreach (var hit in result.Hits) { obj.Add(new SearchResultFilterData { Description = hit.Source.Description.ToString(), MarkIn = hit.Source.MarkIn.ToString(), MarkOut = hit.Source.MarkOut.ToString(), ShotType = hit.Source.MarkOut.ToString(), DeliveryType = hit.Source.DeliveryType.ToString() }); } } } } return(Ok(new { results = obj })); }
public IActionResult postSegments(STFilterRequestData _objReqData) { try { List <ResponseResult> value = new List <ResponseResult>(); searchcricket sc = new searchcricket(); QueryContainer _objNestedBoolQuery = new QueryContainer(); // EsClient = oLayer.CreateConnection(); if (_objReqData != null) { MatchDetail _objMatchDetail = _objReqData.MatchDetail; dynamic _objS1Data = _objReqData.S1Data; Moments _objMomentsData = _objReqData.Moments; if (_objMatchDetail != null) { _objNestedBoolQuery = sc.GetMatchDetailQueryST(_objNestedBoolQuery, _objMatchDetail); } if (_objS1Data != null) { _objNestedBoolQuery = sc.getCricketPlayerDetails(_objS1Data, _objNestedBoolQuery); _objNestedBoolQuery = sc.GetCricketMatchSituationQueryST(_objNestedBoolQuery, _objS1Data); //_objSearchResults.ResultData = LSObject.SearchStoryTeller(_objNestedBoolQuery, _objMatchDetail); } if (_objMomentsData != null) { if (!string.IsNullOrEmpty(_objMomentsData.Entities) || _objMomentsData.IsBigMoment || _objMomentsData.IsFunnyMoment || _objMomentsData.IsAudioPiece) { QueryContainer _objNestedBoolQueryFor2 = new QueryContainer(); _objNestedBoolQueryFor2 = sc.GetMatchDetailQueryST(_objNestedBoolQueryFor2, _objMatchDetail); _objNestedBoolQueryFor2 = sc.GetS2MomentDetailQueryForST(_objMatchDetail, _objNestedBoolQueryFor2, _objMomentsData); // if (_objLstSearchQuery.Count > 3)///If the count is more than matchdetail query list (need to rethink) //{ // _objSearchResults2.ResultData = LuceneService.FetchSearchResultFilterData(_objNestedBoolQueryFor2, sportid, "s2"); //} } } } return(Ok(new { results = value })); } catch (Exception ex) { return(BadRequest(ex.Message.ToString())); } }
public IActionResult GetSearchResultsFilter(STFilterRequestData _objReqData) { ExtendedSearchResultFilterData _objSearchResults = new ExtendedSearchResultFilterData(); ExtendedSearchResultFilterData _objSearchResults2 = new ExtendedSearchResultFilterData(); ExtendedSearchResultFilterData _objResult = new ExtendedSearchResultFilterData(); searchcricket sc = new searchcricket(); _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(); QueryContainer _objCricketResult = new QueryContainer(); if (_objReqData != null) { MatchDetail _objMatchDetail = _objReqData.MatchDetail; int sportid = _objMatchDetail.SportID; dynamic _objS1Data = _objReqData.S1Data; MatchSituation _objMatchSituation = _objReqData.MatchSituation; Moments _objMomentsData = _objReqData.Moments; if (_objMatchDetail != null) { _objNestedQuery = sc.GetMatchDetailQueryST(_objNestedQuery, _objMatchDetail); } if (_objS1Data != null) { if ("CRICKET" == sc.getType(sportid)) { IEnumerable <SearchResultFilterData> _objSearchResultsFilterData = new List <SearchResultFilterData>(); //_objNestedQuery = sc.getCricketPlayerDetails( _objS1Data, _objNestedQuery); //_objNestedQuery = sc.GetCricketMatchSituationQueryST(_objNestedQuery, _objMatchSituation); //_objSearchResults.ResultData = LSObject.SearchStoryTeller(_objNestedBoolQuery, _objMatchDetail); if (!_objMatchDetail.IsAsset) { Cricket objCs = new Cricket(); EsClient = oLayer.CreateConnection(); //_objCricketResult = sc.GetMatchDetailQueryST(_objCricketResult, _objMatchDetail); _objCricketResult = sc.getCricketPlayerDetails(_objS1Data, _objNestedQuery); _objCricketResult = sc.GetCricketMatchSituationQueryST(_objNestedQuery, _objMatchSituation); CommonFunction cf = new CommonFunction(); GetSearchS1DataForCricket sqObj = new GetSearchS1DataForCricket(); //string value = sqObj.GetKeyValueForSport(sc.getType(sportid), "DropdwonKey"); QueryContainer queryShould = new QueryContainer(); QueryContainer queryAnd = new QueryContainer(); QueryContainer queryAnd_should = new QueryContainer(); //List<string> valueObj = sqObj.GetKeyValueForSportTemp(sc.getType(sportid), "PlayerDetails"); //string[] valuessObj = valueObj.ToList(); //for (int i = 0; i <= valueObj.Count-1; i++) //{ // string sType = valueObj[i].Split(",")[1]; // if (sType == "Boolean") { // if (Convert.ToBoolean(_objS1Data[valueObj[i].Split(":")[1].Split(",")[0]])) // { // QueryContainer query1 = new TermQuery { Field = valueObj[i].Split(",")[2], Value = "1" }; // queryShould |= query1; // } // } // if (sType == "string") { // if (Convert.ToString(_objS1Data[valueObj[i].Split(":")[1]]) != "") // { // string slist = Convert.ToString(_objS1Data[valueObj[i].Split(",")[0].Split(":")[1]]); // if (slist.Contains(",")) // { // string[] strArray = slist.Split(','); // foreach (string str in strArray) // { // QueryContainer query9 = new TermQuery { Field = valueObj[i].Split(",")[2], Value = str }; // queryShould |= query9; // } // } // else { // QueryContainer query10 = new TermQuery { Field = valueObj[i].Split(",")[2], Value = Convert.ToString(_objS1Data[valueObj[i].Split(",")[0].Split(":")[1]]) }; // queryAnd &= query10; // } // } // } // if (valueObj[i].Split(":")[0] == "OR") { // queryAnd_should &= queryShould; // } //} //queryAnd &= queryAnd_should; //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 }; // _objSearchResults.Master.MasterData = objCs.fetchDropdowns(_objNestedQuery, _objSearchResults.Master.MasterData, EsClient, "cricket", cf.GetColumnForEntity(Convert.ToInt16(item[1])), _objType); //} //if (!string.IsNullOrEmpty(_objMatchSituation.Innings)) //{ // List<FilteredEntityData> obj2 = new List<FilteredEntityData>(); // Dictionary<string, object> objInning = new Dictionary<string, object>(); // string[] _objReqInnings = _objMatchSituation.Innings.Contains(",") ? _objReqInnings = _objMatchSituation.Innings.Split(',') : _objReqInnings = new string[] { _objMatchSituation.Innings }; // for (int i = 1; i <= 2; i++) // { // obj2.Add(new FilteredEntityData // { // EntityId = i.ToString(), // EntityName = i.ToString(), // IsSelectedEntity = _objReqInnings.Contains(i.ToString()) ? 1 : 0 // }); // } // objInning.Add("Innings", obj2); // _objSearchResults.Master.MasterData = objInning; //} string[] _objReqInnings = _objMatchSituation.Innings.Contains(",") ? _objReqInnings = _objMatchSituation.Innings.Split(',') : _objReqInnings = new string[] { _objMatchSituation.Innings }; 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"] }; _objSearchResults.Master.MasterData = sc.parseDropdown(_objCricketResult, _objResult.Master.MasterData, EsClient, _objReqInnings, _objReqShotType, _objReqDeliveryType); _objResult.ResultData = sc.getSegementsData(EsClient, _objCricketResult); _objSearchResults.ResultData = _objResult.ResultData; } else { _objNestedQuery = sc.getCricketPlayerDetails(_objS1Data, _objNestedQuery); _objNestedQuery = sc.GetCricketMatchSituationQueryST(_objNestedQuery, _objMatchSituation); } if (_objMomentsData != null) { if (!string.IsNullOrEmpty(_objMomentsData.Entities) || _objMomentsData.IsBigMoment || _objMomentsData.IsFunnyMoment || _objMomentsData.IsAudioPiece) { QueryContainer _objNestedBoolQueryFor2 = new QueryContainer(); _objNestedBoolQueryFor2 = sc.GetMatchDetailQueryST(_objNestedBoolQueryFor2, _objMatchDetail); _objNestedBoolQueryFor2 = sc.GetS2MomentDetailQueryForST(_objMatchDetail, _objNestedBoolQueryFor2, _objMomentsData); _objSearchResults2.ResultData = sc.getSegementsData(EsClient, _objNestedBoolQueryFor2); } _objResult.ResultData = _objSearchResults.ResultData.Union(_objSearchResults2.ResultData); } } } } return(Ok(new { responseText = _objSearchResults })); }