-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add Query by Example feature #2418 #2422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Query by Example feature #2418 #2422
Conversation
Added Query by Example repositories fragments Added Criteria.regexp
Sorry I didn't comment earlier, thanks for the PR. I had no time yet to look at it (I was busy on #2419). Will have a look these days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive work, thanks a lot for that. I have some minor comments, and one place where I think the logic for getting the property name is not correct.
One thing that I don't like - and that has nothing to do with your implementation - is that by implementing org.springframework.data.repository.query.QueryByExampleExecutor
we have to do this unwrapping in the methods of QueryByExampleElasticsearchExecutor
; we discard all the additional information that is available in the SearchHit<T>
objects.
This could be solved by creating a new interface SearchHitsQueryByExampleExecutor
(I don't have a better name currently) where we have the same methods, but different return types (SearchHits<T>
or maybe List<SearchHit<T>>
). The implementation for that would be similar to what you did but without the unwrapping.
Maybe we could have both, and the unwrapping implementation might use the other one to get the SearchHit
s and then unwrap them.
What do you think about that? We can merge your changes and have that other as an additional feature later.
src/main/java/org/springframework/data/elasticsearch/core/query/Criteria.java
Outdated
Show resolved
Hide resolved
...ingframework/data/elasticsearch/repository/support/querybyexample/ExampleCriteriaMapper.java
Show resolved
Hide resolved
...ingframework/data/elasticsearch/repository/support/querybyexample/ExampleCriteriaMapper.java
Outdated
Show resolved
Hide resolved
...ingframework/data/elasticsearch/repository/support/querybyexample/ExampleCriteriaMapper.java
Outdated
Show resolved
Hide resolved
...ingframework/data/elasticsearch/repository/support/querybyexample/ExampleCriteriaMapper.java
Show resolved
Hide resolved
In addition this would allow to have method overloads that not only accept a |
Fixed Criteria.regexp Minor fixes in QueryByExample fragments and mapper Improved test coverage
Comments solved in bbadfe9 About creating a new interface I think we could work on it on another PR. |
Added Query by Example repositories fragments
Added Criteria.regexp
Closes #2418