how to create more accurate searching c#
var keywords = new [] {"Sergey", "Berezovskiy"};
var users = from u in context.Users
let match = (keywords.Contains(u.FirstName) ? 1 : 0) +
(keywords.Contains(u.LastName) ? 1 : 0) +
(keywords.Contains(u.MiddleName) ? 1 : 0)
where match > 0
orderby match descending,
u.LastName, u.FirstName
select u;
var methodChain = context.Users
.Select(u => new
{
u,
match = (keywords.Contains(u.FirstName) ? 1 : 0) +
(keywords.Contains(u.LastName) ? 1 : 0) +
(keywords.Contains(u.MiddleName) ? 1 : 0)
})
.Where(t => t.match > 0)
.OrderByDescending(t => t.match)
.ThenBy(t.u.LastName)
.ThenBy(t.u.FirstName)
.Select(t => t.p);