DATAES-552 - @Query annotation fail when passing over 10 parameters

Updated the replacePlaceholders methods to use replaceFirst to prevent duplication substitutions.

Original Pull Request: #267
This commit is contained in:
Taylor 2019-03-24 13:59:50 -07:00 committed by Christoph Strobl
parent 179c3079bd
commit cc8f0c8ab7

View File

@ -32,6 +32,7 @@ import org.springframework.util.Assert;
* @author Rizwan Idrees
* @author Mohsin Husen
* @author Mark Paluch
* @author Taylor Ono
*/
public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQuery {
@ -86,8 +87,9 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
String result = input;
while (matcher.find()) {
String group = matcher.group();
group = "\\" + group;
int index = Integer.parseInt(matcher.group(1));
result = result.replace(group, getParameterWithIndex(accessor, index));
result = result.replaceFirst(group, getParameterWithIndex(accessor, index));
}
return result;
}