#How to fuzzy search through IQueryable.
1 messages · Page 1 of 1 (latest)
private static IQueryable<Leaderboard> FilterBySearch(this IQueryable<Leaderboard> sequence, string? search)
{
if (search == null)
{
return sequence;
}
string lowSearch = search.ToLower();
return sequence.Where(leaderboard => leaderboard.Song.Id == lowSearch
|| leaderboard.Song.Hash == lowSearch
|| leaderboard.Song.Author.Contains(lowSearch)
|| leaderboard.Song.Mapper.Contains(lowSearch)
|| leaderboard.Song.Name.Contains(lowSearch));
}``` tl;dr replacing contains with a fuzzy search
In case you have not solved this, Instead of contains you can use a Regex, for example if your search keyword is dog you can make a /d|o|g/g regex which will match any word that has any of the letters of the word dog ( d,o,g ) or make a regex that the word must contain all letters of the search, thats an easy way to make a faux fuzzy search
regex only works on inputs that are constant
i thought i close this th