Search in database for more then one column (EFCore, Postgresql)
Hello
in Employee table i have column: FirstName and LastName
those examples in search query should work
- John
- Smith
- Smith John
- John Smith
- John S
my first thought (from gpt chat 😉 ) is to split query like :
What u think about this ?
Problem, what if add filter for example Location but dont want split search query then
1 Reply
what's stopping you from just making your own search function? Take in the record and the search term, feed it into a function, return true or false wether it matches.
.Where(e => IsMatchingEmployee(e, searchTerm))
and then you can chain on whatever else you want to do, eg location.