I don't know your use case, but, you may consider changing your approach. Agreed with @NElliott on that. Or you can call a restlet to do your dirty work and call that restlet for each search you want to perform. There are other ways to do this as well .What's your use case?