private bool FullTextMatch(string strSearch, Error404Redirect obj) { if (String.IsNullOrWhiteSpace(strSearch)) { return(true); } var tokens = FullTextSearch.Tokenize(strSearch); bool blnHasNotToken = tokens.Where(t => t.StartsWith("-")).Count() > 0; bool blnMatchedHardBlock = false; bool blnMatched = false; if (tokens.Where(t => t.StartsWith("-")).Count() == tokens.Count()) //If I'm only using negative matches, then show everything that isn't eliminated. { blnMatched = true; } if (FullTextSearch.TokenContains(obj.From, tokens, out blnMatchedHardBlock)) { blnMatched = true; } if (blnHasNotToken && blnMatchedHardBlock) { return(false); } else if (!blnHasNotToken && blnMatched) { return(true); } if (FullTextSearch.TokenContains(obj.To, tokens, out blnMatchedHardBlock)) { blnMatched = true; } if (blnHasNotToken && blnMatchedHardBlock) { return(false); } else if (!blnHasNotToken && blnMatched) { return(true); } if (!String.IsNullOrWhiteSpace(obj.ClientID)) { if (FullTextSearch.TokenContains(obj.ClientID, tokens, out blnMatchedHardBlock)) { blnMatched = true; } if (blnHasNotToken && blnMatchedHardBlock) { return(false); } else if (!blnHasNotToken && blnMatched) { return(true); } } if (FullTextSearch.TokenEquals(obj.RedirectType.ToString(), tokens, out blnMatchedHardBlock)) { blnMatched = true; } if (blnHasNotToken && blnMatchedHardBlock) { return(false); } else if (!blnHasNotToken && blnMatched) { return(true); } return(blnMatched); /* * Original (simple) token matching * if (tokens.Any(t => obj.From.ToLower().Contains(t))) * return true; * if (tokens.Any(t => obj.To.ToLower().Contains(t))) * return true; * if (obj.ClientID != null) * if (tokens.Any(t => obj.ClientID.ToString().Equals(t))) * return true; * if (tokens.Any(t => obj.RedirectType.ToString().Equals(t))) * return true; */ }
public Error404Redirect Put(string AppID, Error404Redirect error) { return(General.ErrorLogging.Data.Error404Redirect.UpdateError404Redirect(error)); }