--- a/src/common/rclinit.cpp
+++ b/src/common/rclinit.cpp
@@ -14,12 +14,16 @@
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include "autoconfig.h"
#include <stdio.h>
#include <signal.h>
#include <locale.h>
#include <pthread.h>
#include <cstdlib>
+#if !defined(PUTENV_ARG_CONST)
+#include <string.h>
+#endif
#include "debuglog.h"
#include "rclconfig.h"
@@ -96,6 +100,18 @@
// threads don't try to do it at once).
config->getDefCharset();
+ int flushmb;
+ if (config->getConfParam("idxflushmb", &flushmb) && flushmb > 0) {
+ LOGDEB(("rclinit: idxflushmb=%d, set XAPIAN_FLUSH_THRESHOLD to 10E6\n",
+ flushmb));
+ static const char *cp = "XAPIAN_FLUSH_THRESHOLD=1000000";
+#ifdef PUTENV_ARG_CONST
+ ::putenv(cp);
+#else
+ ::putenv(strdup(cp));
+#endif
+ }
+
return config;
}