public IActionResult SearchText(SearchApiModel model) { var ids = this.searchService.Search(model); var res = this.FilterSearchResult(ids, model); return(Ok(res)); }
public int[] Search(SearchApiModel model) { var sp = new MainSearch(); if (!string.IsNullOrEmpty(model.SearchText)) { sp.SearchText = model.SearchText; } if (model.Classifiers?.Count > 0) { model.Classifiers.ForEach(x => sp.ClassificatorsGroups.Add(new System.Collections.Generic.List <string> { x })); //sp.ClassificatorsGroups.Add(model.Classifiers); } var queries = sp.GetQueries(); var ids = this.searchWrapper.SearchDictQueryList(queries, true); ids = this.resultsGrouper.FilterConsolidatedLanguageVersions(ids, this.filterDocsStruct, model.LangPreferences); if (model.LangPreferences?.Length > 0) { this.filterDocsStruct.FilterArray(ref ids, model.LangPreferences); } //cons versions grouper ids = this.resultsGrouper.FilterResults(ids); return(ids); }
public IActionResult GetEuDateProtectionBoard(SearchApiModel searchModel) { var res = new LegislationResponseModel(); res.Categories = this.GetEuDateProtectionBoardCategories(searchModel); return(Ok(res)); }
public IActionResult GetEuCaseLaw(SearchApiModel searchModel) { var res = new LegislationResponseModel(); res.Categories = this.GetEuCaseLawCategories(searchModel); return(Ok(res)); }
public void Tmp() { var searchApiModel = new SearchApiModel { SearchText = "regulation", LangPreferences = new[] { 4 } }; var ids = this.searchService.Search(searchApiModel); }
private List <CategoryResponseModel> GetEuDateProtectionBoardCategories(SearchApiModel searchModel) { var baseClassifier = "0319DD51-EE78-4F0C-B948-E8F8BD0FE0E1"; var res = new List <CategoryResponseModel>(); res.Add(GetLegDocsByClassifier(searchModel, "8D1F1268-97C4-4A4B-8F6B-0E7866869573", "Guidelines1", baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "C83789FC-77F3-4381-9880-66E98A04A47B", "OtherDocuments", baseClassifier)); return(res); }
public void TestSearchCyrillic() { var searchApiModel = new SearchApiModel { SearchText = "закон" }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(161, ids.Length); }
public void TestSearchText() { var searchApiModel = new SearchApiModel { SearchText = "1" }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(640, ids.Length); }
public void TestSearchEnglish() { var searchApiModel = new SearchApiModel { SearchText = "regulation" }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(184, ids.Length); }
private List <CategoryResponseModel> GetItCategories(SearchApiModel searchModel) { var baseClassifier = "57B81A94-F630-4D12-A062-1882AF4DF437"; var res = new List <CategoryResponseModel>(); res.Add(GetLegDocsByClassifier(searchModel, "938AD68B-0057-4B28-AEA1-99EC41764C13", keyInstrumenst, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "A6811773-16BA-4BE9-AE74-EC947F7724C4", treaties, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "9A609948-49D0-45AB-A2DC-7D98AB7B03CA", otherInstruments, baseClassifier)); return(res); }
public int[] Search(SearchApiModel model) { var url = "searches/st"; var temp = this.proxyClient.PostAsJsonAsync(url, model) .Result .EnsureSuccessStatusCode() .Content.ReadAsStringAsync().Result; var docIds = JsonConvert.DeserializeObject <int[]>(temp); docIds = docIds ?? new int[0]; return(docIds); }
public void TestSearchInternational() { var searchApiModel = new SearchApiModel { Classifiers = new List <string> { "A653D24E-0AA1-449A-AE3E-973D25FE6137", } }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(10, ids.Length); }
private List <CategoryResponseModel> GetEuCaseLawCategories(SearchApiModel searchModel) { var baseClassifier = "0C6CC932-1EE3-4F9B-A1FD-B35B68F61578"; var res = new List <CategoryResponseModel>(); res.Add(GetLegDocsByClassifier(searchModel, "5BC8F8DD-2165-4582-AD4B-2BBFAE51088D", "CaseLawRelatedToTheGDPR", baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "6E6A168D-5DE0-46C7-99EB-C0BDF9DD6E19", "CaseLawDataProtectionDirective", baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "B19FED0E-F5F9-4800-94B2-3BCB990AC4A6", "CaseLawDirective2002/58/EC", baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "3681858C-05B7-4F4F-B311-87B2D0C6E90E", "CaseLawDirective2016/681", baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "BF5A9F72-21F7-465A-ACDF-6031B4BC6A7C", "CaseLawEUInstitutionsDataProtectionRegulation", baseClassifier)); return(res); }
private List <CategoryResponseModel> GetBgCategories(SearchApiModel searchModel) { var baseClassifier = "E729EE04-2FED-48BC-A6C9-10EBAA85D14B"; var res = new List <CategoryResponseModel>(); res.Add(GetLegDocsByClassifier(searchModel, "938AD68B-0057-4B28-AEA1-99EC41764C13", keyInstrumenst, baseClassifier)); //res.Add(GetLegDocsByClassifier(searchModel, "A6811773-16BA-4BE9-AE74-EC947F7724C4", treaties, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "9A609948-49D0-45AB-A2DC-7D98AB7B03CA", otherInstruments, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "06147F9E-CE58-48C7-8892-6DF7476DE3AA", repealedInstruments, baseClassifier)); // return(res); }
public void TestSearchBulgariaTreaties() { var searchApiModel = new SearchApiModel { Classifiers = new List <string> { "E729EE04-2FED-48BC-A6C9-10EBAA85D14B", "A6811773-16BA-4BE9-AE74-EC947F7724C4" } }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(2, ids.Length); }
public void TestSearchBulgariaKeyInstruments() { var searchApiModel = new SearchApiModel { Classifiers = new List <string> { "E729EE04-2FED-48BC-A6C9-10EBAA85D14B", "938AD68B-0057-4B28-AEA1-99EC41764C13" } }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(86, ids.Length); }
public void TestSearchBulgariaOthers() { var searchApiModel = new SearchApiModel { Classifiers = new List <string> { "E729EE04-2FED-48BC-A6C9-10EBAA85D14B", "9A609948-49D0-45AB-A2DC-7D98AB7B03CA" } }; var ids = this.searchService.Search(searchApiModel); Assert.AreEqual(8, ids.Length); }
private List <CategoryResponseModel> GetEuCategories(SearchApiModel searchModel) { var baseClassifier = "BE076ED2-9F60-4B24-9560-19B5E672D947"; var res = new List <CategoryResponseModel>(); res.Add(GetLegDocsByClassifier(searchModel, "938AD68B-0057-4B28-AEA1-99EC41764C13", keyInstrumenst, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "A6811773-16BA-4BE9-AE74-EC947F7724C4", treaties, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "9A609948-49D0-45AB-A2DC-7D98AB7B03CA", otherInstruments, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "0C9C6F5C-2C04-401F-988F-FAAE03B12AA7", schengenAcquis, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "F7FA0E11-6FFB-4B2A-9A24-7DCB6A2506EB", adequacyDecisions, baseClassifier)); res.Add(GetLegDocsByClassifier(searchModel, "06147F9E-CE58-48C7-8892-6DF7476DE3AA", repealedInstruments, baseClassifier)); return(res); }
public async Task <SearchApiModel> Search(string q) { int searchLimit = 6; var _users = FindUsersAsync(q); var _stations = FindStationsAsync(q); var tmp = new SearchApiModel { People = (await _users).Take(searchLimit), Stations = (await _stations).Take(searchLimit) }; return(tmp); }
public async Task <LegislationResponseModel> GetLegislation(SearchApiModel model, string action) { using (HttpClient client = new HttpClient()) { var url = Path.Combine(this.baseUrl, $"searches/{action}"); var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); var res = await client.PostAsync(url, stringContent) .Result .EnsureSuccessStatusCode() .Content.ReadAsStringAsync() .ConfigureAwait(false); return(JsonConvert.DeserializeObject <LegislationResponseModel>(res)); } }
public SearchResultModel GetDocList(int[] ids, SearchApiModel model) { ids = ids ?? new int[0]; var res = new SearchResultModel(); res.TotalCount = ids.Length; res.PageSize = (model.PageSize == 0) ? Math.Max(1, res.TotalCount) : model.PageSize; res.PageNum = model.PageNum == 0 ? 1 : model.PageNum; var pagesCount = Math.Ceiling((double)res.TotalCount / (double)res.PageSize); if (res.PageNum <= pagesCount) { ids = ids.Skip((res.PageNum - 1) * res.PageSize).Take(res.PageSize).ToArray(); } res.Data = this.dbHelper.GetDocListData(ids); return(res); }
private SearchResultModel FilterSearchResult(int[] ids, SearchApiModel model) { ids = this.euCaselawFilterService.Filter(ids); if (model.Classifiers?.Count > 0) { ids = this.sortService.SortIds(model.Classifiers, ids); var sr = this.docService.GetDocList(ids, model); //sort this.sortService.SortSearchResult(model.Classifiers, sr); return(sr); } else { var res = this.docService.GetDocList(ids, model); var sortDict = ids.ToList().Select((x, index) => (k: x, v: index)).ToDictionary(k => k.k, index => index.v); res.Data = res.Data.OrderBy(x => sortDict.ContainsKey(x.DocLangId) ? sortDict[x.DocLangId] : 100000).ToList(); return(res); } }
public async Task <SearchResultModel> GetClassifier(SearchApiModel model) { ObservableCollection <DocumentResponseModel> euDocs = new ObservableCollection <DocumentResponseModel>(); euDocs.Clear(); using (HttpClient client = new HttpClient()) { var url = Path.Combine(this.baseUrl, $"searches/st"); var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json"); var res = await client.PostAsync(url, stringContent) .Result .EnsureSuccessStatusCode() .Content.ReadAsStringAsync() .ConfigureAwait(false); return(JsonConvert.DeserializeObject <SearchResultModel>(res)); } }
private CategoryResponseModel GetLegDocsByClassifier(SearchApiModel searchModel, string classifier, string headingName, string baseClassifier) { searchModel.Classifiers = new List <string>(); searchModel.Classifiers.Add(baseClassifier); searchModel.Classifiers.Add(classifier); var res = new CategoryResponseModel(); var ids = this.searchService.Search(searchModel); ids = this.euCaselawFilterService.Filter(ids); ids = this.sortService.SortIds(searchModel.Classifiers, ids); var sr = this.docService.GetDocList(ids, searchModel); //sort this.sortService.SortSearchResult(searchModel.Classifiers, sr); res.Items.AddRange(sr.Data); res.Heading = headingName; return(res); }
private SearchApiModel GetJobProfileSearchApiModel() { var result = new SearchApiModel { Results = new List <SearchItemApiModel> { new SearchItemApiModel { ResultItemTitle = "Title 1", ResultItemAlternativeTitle = "Alt title 1", ResultItemOverview = "Overview 1", ResultItemSalaryRange = "Salary range 1", ResultItemUrlName = "url name 1", JobProfileCategories = new List <JobProfileCategoryApiModel> { new JobProfileCategoryApiModel { Name = "category-1", Title = "Category 1", }, }, }, new SearchItemApiModel { ResultItemTitle = "Title 2", ResultItemAlternativeTitle = "Alt title 2", ResultItemOverview = "Overview 2", ResultItemSalaryRange = "Salary range 2", ResultItemUrlName = "url name 2", JobProfileCategories = new List <JobProfileCategoryApiModel> { new JobProfileCategoryApiModel { Name = "category-2", Title = "Category 2", }, }, }, new SearchItemApiModel { ResultItemTitle = "Title 3", ResultItemAlternativeTitle = "Alt title 3", ResultItemOverview = "Overview 3", ResultItemSalaryRange = "Salary range 3", ResultItemUrlName = "url name 3", JobProfileCategories = new List <JobProfileCategoryApiModel> { new JobProfileCategoryApiModel { Name = "category-3", Title = "Category 3", }, }, }, new SearchItemApiModel { ResultItemTitle = "Title 4", ResultItemAlternativeTitle = "Alt title 4", ResultItemOverview = "Overview 4", ResultItemSalaryRange = "Salary range 4", ResultItemUrlName = "url name 4", JobProfileCategories = new List <JobProfileCategoryApiModel> { new JobProfileCategoryApiModel { Name = "category-4", Title = "Category 4", }, }, }, }, }; result.Count = result.Results.Count(); return(result); }