Case Insensitive search #396
Replies: 5 comments 15 replies
-
Hmm that's strange... Note: this is where that translation happens: https://github.com/ardalis/Specification/blob/main/Specification.EntityFrameworkCore/src/Ardalis.Specification.EntityFrameworkCore/Extensions/SearchExtension.cs PS: you can uncomment some lines in BaseDbContext (at least in the latest source) to see the exact queries that efcore is executing... Btw, just so you know: Specifications only define what exactly it is it needs to select/filter/sort, they must be seen as lightweight dto's which just contain the metadata about a query. They don't execute anything. The execution itself is up to the SpecificationEvaluator which lives in infrastructure, while the specfications live in the application/domain layer... |
Beta Was this translation helpful? Give feedback.
-
It seems postgresql's default collation plays a part in it... here's some interesting links on the topic: |
Beta Was this translation helpful? Give feedback.
-
Hmm okk... I used Thank you for explanation about specifications. This is the first time I faced up with them, so in case I fail to figure out some "cleaner" solution, I have backup plan.. I added two searchCriteria next to existing one:
|
Beta Was this translation helpful? Give feedback.
-
I fail to see how that's a solution to your problem... if you do ToUpper/ToLower on the value, you need to do ToUpper/ToLower on the selector as well... |
Beta Was this translation helpful? Give feedback.
-
Hi @fretje, I also wonder where this evaluator class should be placed - in the Infrastructure or Application layer? |
Beta Was this translation helpful? Give feedback.
-
Hi!
I'm using PostgreSQL and as I can see, search is case sensitive.
How can I apply search which is case insensitive?
I'm looking at
class SpecificationBuilderExtensions
andSearchByKeyword<T>
method and as I can see only property name ignoring the case.Is it the right place to modify and how to modify query?
Beta Was this translation helpful? Give feedback.
All reactions