I've read in various places that one important requirement in DDD is to have a bounded contract for the Repository:
findByName(string name)
findByEmail(string email)
etc.
And not provide a generic query interface:
findBySpecification(Specification spec)
I do understand why this is important: to be able to mock the Repository for tests, or change the underlying persistence framework.
While this rule is not that hard to enforce throughout the application, I can't figure out how to enforce it when it comes to provide the user with an "advanced search" form.
Let's say I have a form which allows to search blog posts by keyword, by date, by author, etc.
These criteria being freely combinable, I obviously can't provide a method for each use case:
findByKeyword(string keyword)
findByDateRange(Date from, Date to)
findByKeywordAndDateRange(string keyword, Date from, Date to)
findByDateRangeAndAuthor(Date from, Date to, User author)
etc.
Am I missing something or is it one of the exceptions to the rule?