问题描述
我通过自定义开发的层对 solr 进行查询,而我在层中超时的一些查询仍在 solr 实例中.solr 中是否有参数可用于使特定查询超时
I hitting queries to solr through a custom developed layer and few queries which i time out in my layer are still in the solr instance. Is there a parameter in solr which can be used to time out an particular query
推荐答案
如中所述Solr 查询在客户端断开连接后继续? 和 写在 Solr FAQ 中
在内部,Solr 不会对任何请求进行超时处理——它允许更新和查询需要花费多长时间才能被完全处理.
但是在 FAQ 的同一个地方写着
But at the same spot in the FAQ is written
然而,用于运行 Solr 的 servlet 容器可能会对所有请求施加任意超时限制.如果您发现此值太低,请查阅您的 Serlvet 容器的文档.(在Jetty中,相关设置为maxIdleTime",单位为毫秒)
因此,您可以将容器配置为关闭长时间运行的请求,以便连接的 HTTPClient 接收关闭.
So you may configure your container to close a long-running request so that the HTTPClients connected receive a shutdown.
然而,这可能还不够,Solr 可以在内部仍然工作,在您的服务器上产生负载.因此可以使用 公共 timeAllowed 参数.
However that may not be enough, Solr could internally still be working though, generating load on your Server. Therefore the common timeAllowed parameter may be used.
timeAllowed - 此参数指定允许完成搜索的时间量(以毫秒为单位).如果此时间在搜索完成之前到期,则将返回任何部分结果.
无论是在每个请求中还是在 solrconfig.xml 中配置为默认值.
Either with each request or configured as default in your solrconfig.xml.
<requestHandler name="standard" class="solr.StandardRequestHandler" default="true">
<lst name="defaults">
<!-- other parts left out -->
<!-- timeout (in milliseconds) -->
<int name="timeAllowed">5000</int>
</lst>
</requestHandler>
这篇关于在 Solr 中超时查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!