How do I run multiple requests in a batch?

谁都会走 提交于 2019-12-11 10:35:41

问题


Is it possible to run multiple solr requests in a batch? I would like to run multiple queries at once and get all the results in one request.


回答1:


Query batching is a pending issue. You can do the following (in descending order of usefulness):

  • Implement the feature and submit it as a patch to the aforementioned JIRA issue.
  • Collaborate with other people interested in this feature, by posting a suggestion to the aforementioned JIRA issue.
  • Implement concurrent querying client-side (i.e. without any kind of support from Solr).
  • Vote/watch the aforementioned JIRA issue.



回答2:


I am not sure if you are still looking for this feature. If you are, you could checkout the patch I submitted recently.

https://issues.apache.org/jira/browse/SOLR-1093

We have been using it in our production servers and it has been running fine for more than a month now.




回答3:


not sure you can do that. You can only run one query at a time. If you want to run many queries at the same time, you can multithread your queries




回答4:


I did a fix on Karthick's solution. If multi queries were sent, the resulting json would be invalid, since it'd have two or more "response" keys. In this patch, each response has an identifier of the corresponding query. Eg.: { "1.response" : ..., "2.response" : ... }

Notice: The patch should be applied with patch -p1 and it was done from lucene 5.3



来源:https://stackoverflow.com/questions/6152524/how-do-i-run-multiple-requests-in-a-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!