-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add support for named parameters in string queries #2183
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
Comments
ping @mp911de: do we have parameter resolution by name in other Spring Data modules? Do we have the names of the parameters at parameter resolving time? |
Yes, there's access to named parameters via |
With the implementation of #2083 it is now possible to use a named query like this:
|
The implementation from the PR is a little complicated. |
Will have a look at the injection issue. As for the SpEL stuff: It's hard to know what's available in spring-data-commons without following every PR/change, I didn't find anything about the Looking at that merge(spring-projects/spring-data-commons#3050), if I understand it correctly, |
I looked into the With @Query("""
{
"match": {
"text": {
"query": :#{#foo}
}
}
}
""")
SearchHits<Foo>searchByFoo(String foo); Indeed the
PLUS: the official docs for spring-data-commons are indeed imperfect, and when searching on the web, most of the information is about the subprojects of spring-data-commons, which makes learning spring-data-commons difficult too. |
hi,
it would be nice to have support for named parameters in
@Query
queries, similarly to e.g. spring-data-jpa:instead of
looking for patterns with
:
would be tricky because of the ES query syntax so we could make that behavior explicit instead; let the user define if a query is using positional or named parameters with a new flag.created a WIP here: diamondT@cd3d2cc
if this is something worth pursuing i can polish a bit more and send a PR.
thanks,
The text was updated successfully, but these errors were encountered: