Hi!
First of all thanks for the feedback. I really appreciate.
I will try to answer all the questions.
1. "It does seem mainly focussed on Symfony/Doctrine" - if by "focussed" you mean, that there are already implemented contexts for Doctrine ORM, ODM and Elastica then you are right (thats because I was working with those contexts), but we could add more and more contexts in the future as you said. There is a bundle for Symfony, but I've picked Symfony just because I had some experience with it. We could easily create module for Zend for example and other frameworks. Framework modules could create services with proper names, maybe some validation and CriteriaCollection hydration and it would already help some people to get started with Searcher.
2. "As I understand it, I could chain for example Eloquent ORM filters where possible" - well.. I think you are referring to
searcher chain, if so then it works a bit differently. By using this you can pass results from first searcher to second one (after proper transformation), when first searcher can use MySQL and other can search for Files. At the end it will return collection of both results. Both searchers in this scenario could have different criteria and criteria builders.
3. "I could imagine this could create a search/filter for Flysystem" - it would be cool to implement some context to work with Flysystem. If flysystem is using Finder then it's already done. I do not know about other adapters for files, but I would like to have one context for all Flysystem's adapters.
4. "It seems to leave up most of the 'boilerplate' code for the CriteriaBuilder up to developer" - this is exactly the idea of searcher. CriteriaBuilders will be created for each Criteria by developer by himself. I do not want to create any assumptions about how to construct query for criteria that holds some values - developer needs to do it and it is not that big amount of work that he needs to do.
5. "Is it currently needed to create a new Criteria for every column you search for, instead of reusing the same classes?" - Simple answer: no, it is not needed. You can create for example IntegerRangeCriteria and use it in different searchers and different criteria builders.
Maybe I wrote it hard to understand way, so I will try to explain briefly how searcher works:
1. We have some criteria. Either already implemented in the library (for simpler searches) or implemented by developer (like PeopleBirthdayRangeCriteria). Criteria itself is not connected to any entity in any way and it can have just 1 or multiple fields - it doesn't matter how complicated it is. What matters is, that CriteriaBuilder can make it.
2. We have some criteria builders - those are services which are constructing the query based on given criteria. Criteria builder for PeopleBirthdayRangeCriteria would use both parameters from PeopleBirthdayRangeCriteria to construct proper query, which will return people who have birthday inside range specified in the criteria. Builder is also making a decision which criteria it supports. It doesn't need to support just one criteria, and one criteria does not need to be consumed by just 1 builder. Besides using criteria, builders have also access to SearchingContext.
3. Searching context is service with responsibility of storing "QueryBuilder" (it might be Doctrine's QueryBuilder, Finder, Elastica or whatever else) and it knows how to fetch results from it.
4. At last we are passing everything to searcher class and we are getting our results :)
In
here you can see complete example.
I hope I've answered all of question. If you have more, please, feel free to ask.
Krzysztof Gzocha