public BlacklistQueryResult Search(SearchCompanyBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Name, nameof(model.Name), e => e.IsNotNullOrEmpty()) .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); // name and country are manditory var query = new DplSearch(); query.AddClause(DplFields.Name, DplSearchMatchType.Similar, model.Name); query.AddClause(DplFields.CountryCode, DplSearchMatchType.Exact, model.CountryCode); if (!string.IsNullOrEmpty(model.City)) { query.AddClause(DplFields.City, DplSearchMatchType.Exact, model.City); } if (model.Uri != null && Uri.IsWellFormedUriString(model.Uri, UriKind.Absolute)) { var uri = new Uri(model.Uri, UriKind.Absolute); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, uri.DnsSafeHost); } if (!string.IsNullOrEmpty(model.StateCode)) { query.AddClause(DplFields.StateCode, DplSearchMatchType.Exact, model.StateCode); } var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistQueryResult Search(SearchPersonBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Name, nameof(model.Name), e => e.IsNotNullOrEmpty()) .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); // name and country are manditory var query = new DplSearch(); query.AddClause(DplFields.Name, DplSearchMatchType.Similar, model.Name); query.AddClause(DplFields.CountryCode, DplSearchMatchType.Exact, model.CountryCode); if (!string.IsNullOrEmpty(model.City)) { query.AddClause(DplFields.City, DplSearchMatchType.Exact, model.City); } if (!string.IsNullOrEmpty(model.Email)) { query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, model.Email); } if (!string.IsNullOrEmpty(model.StateCode)) { query.AddClause(DplFields.StateCode, DplSearchMatchType.Exact, model.StateCode); } var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistQueryResult Search(SearchEmailBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Email, nameof(model.Email), e => e.IsNotNullOrEmpty().MatchesPattern(EmailRegex)); var query = new DplSearch(); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, model.Email); var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistQueryResult Search(SearchDomainBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Uri, nameof(model.Uri), e => e.IsNotNull().Satisfies(x => Uri.IsWellFormedUriString(x, UriKind.Absolute))); var uri = new Uri(model.Uri); var query = new DplSearch(); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, uri.DnsSafeHost); var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }