简体   繁体   English

如何知道何时完成Solr Optimize?

[英]How to know when Solr Optimize is done?

I am using the Solr-php-client to communicate with Solr, via php. 我正在使用Solr-php-client通过php与Solr通信。

This piece of code triggers the solr optimize command: 这段代码触发solr optimize命令:

  $solr->optimize();

I wonder if there is any method to know for sure that the optimization is done? 我想知道是否有任何方法可以确定优化已完成?

This is all because I have an administrations page on my website where I manually once a day must optimize the Solr index, but I have difficulty writing this code. 这都是因为我在我的网站上有一个管理页面,我每天手动一次必须优化Solr索引,但是我编写这段代码时遇到了困难。

Currently I have a simple form with a submit button which triggers the optimize() command, but I must somehow confirm that the optimize has taken place, which is the problem here. 目前我有一个带有提交按钮的简单表单,它触发optimize()命令,但我必须以某种方式确认已经发生了优化,这就是问题所在。

Do you know of any method to confirm an optimization in Solr? 您知道在Solr中确认优化的任何方法吗?

Thanks 谢谢

The documentation for the Optimize command specifies that, by default, the command will block until all changes are written to disk and that the new searcher is available. Optimize命令的文档指定,默认情况下,命令将阻塞,直到所有更改都写入磁盘并且新搜索器可用。 So if you keep those default values, when the command returns, you can consider the optimize done. 因此,如果保留这些默认值,则在命令返回时,您可以考虑优化完成。 Note that, depending on the number of segments you currently have and to how many you want to go down to, the command can block for a long time. 请注意,根据您当前拥有的段数以及要删除的段数,该命令可能会阻塞很长时间。 I have seen optimize taking up to an hour to complete. 我看到优化需要一个小时才能完成。

The easiest way is to start optimize from the Solr console, there's an "optimize now" button in the Overview section of your collection. 最简单的方法是从Solr控制台开始优化,在集合的Overview部分中有一个“立即优化”按钮。 If you refresh this screen, you will see the memory used growing until the it doubles, then the status optimized is ticked and the "optimize now" button disapear. 如果刷新此屏幕,您将看到使用的内存不断增长,直到它增加一倍,然后勾选优化状态,并且“立即优化”按钮消失。

NB: You must have enough free disk space to complete the Optimise or it will fail without notice or error message. 注意:您必须有足够的可用磁盘空间来完成优化,否则它将失败,恕不另行通知或错误消息。

This doesn't directly answer your question, but that's another way to deal with solr instance optisation. 这并不能直接回答您的问题,但这是处理solr实例优化的另一种方法。 So I hope it will help. 所以我希望它会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM