Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在关闭Web应用程序之前执行Solr Commit?_Web_Solr_Commit - Fatal编程技术网

如何在关闭Web应用程序之前执行Solr Commit?

如何在关闭Web应用程序之前执行Solr Commit?,web,solr,commit,Web,Solr,Commit,各位。我在Solr使用中遇到了一个问题,在开发环境中,项目总是关闭并启动,启动并关闭,当我们停止Tomcat时,一些Solr文档仍然没有提交。如何克服这一头痛,有人能提出一些想法吗?Great Thanx….您可以在Web应用程序中使用关机挂钩来处理关机并提交数据。 使用在web.xml中实现的类: <web-app> <!-- Usual stuff here --> <listener> <listener-class

各位。我在Solr使用中遇到了一个问题,在开发环境中,项目总是关闭并启动,启动并关闭,当我们停止Tomcat时,一些Solr文档仍然没有提交。如何克服这一头痛,有人能提出一些想法吗?Great Thanx….

您可以在Web应用程序中使用关机挂钩来处理关机并提交数据。
使用在web.xml中实现的类:

<web-app>
    <!-- Usual stuff here -->
    <listener>
        <listener-class>solr.commitListerner</listener-class>
    </listener>
</web-app>

索尔·特利斯特纳

Jayendra,非常感谢。这正是我想要实现的。这几个月我开始使用solr来满足我的工作需要。您对solr搜索大数据有何看法?例如,b2c网站的大量产品。我发现它很慢,而且总是导致outofmemory异常。在2万份文档中搜索通常需要5到6秒,甚至更少。也许我需要优化一些代码。你能给我一些建议吗?谢谢……您应该调整模式和solr配置,以便更好地处理字段。还要检查缓存部分,它可以帮助您提高性能。嘿,Jayendra。我按照你的建议添加了代码,但不幸的是它没有起作用。停止项目时不会调用其contextDestroyed方法。你能给我一些线索吗。。。。。